mirror of
https://github.com/foomo/squadron.git
synced 2025-10-16 12:35:42 +00:00
fix: docker build
This commit is contained in:
parent
401da7e2e6
commit
df2d4f15a4
8
.github/workflows/tag.yml
vendored
8
.github/workflows/tag.yml
vendored
@ -14,9 +14,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Unshallow
|
||||
run: git fetch --prune --unshallow
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
@ -26,7 +25,6 @@ jobs:
|
||||
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
|
||||
|
||||
- id: app_token
|
||||
uses: tibdex/github-app-token@v2
|
||||
with:
|
||||
@ -38,7 +36,7 @@ jobs:
|
||||
|
||||
- uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
version: latest
|
||||
version: '~> v2'
|
||||
args: release --clean
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.app_token.outputs.token }}
|
||||
|
||||
@ -29,10 +29,10 @@ builds:
|
||||
- -s -w -X github.com/foomo/squadron/cmd/actions.version={{.Version}}
|
||||
|
||||
archives:
|
||||
- format: tar.gz
|
||||
format_overrides:
|
||||
- formats: [ tar.gz ]
|
||||
- format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
formats: [ zip ]
|
||||
|
||||
changelog:
|
||||
use: github-native
|
||||
@ -61,7 +61,7 @@ dockers:
|
||||
- '--pull'
|
||||
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
|
||||
- '--label=org.opencontainers.image.title={{.ProjectName}}'
|
||||
- '--label=org.opencontainers.image.description=Docker Compose for Kubernetes'
|
||||
- '--label=org.opencontainers.image.description=CLI utility manage infrastructure as code with helm'
|
||||
- '--label=org.opencontainers.image.source={{.GitURL}}'
|
||||
- '--label=org.opencontainers.image.url={{.GitURL}}'
|
||||
- '--label=org.opencontainers.image.documentation={{.GitURL}}'
|
||||
@ -83,7 +83,7 @@ dockers:
|
||||
- '--pull'
|
||||
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
|
||||
- '--label=org.opencontainers.image.title={{.ProjectName}}'
|
||||
- '--label=org.opencontainers.image.description=Docker Compose for Kubernetes'
|
||||
- '--label=org.opencontainers.image.description=CLI utility manage infrastructure as code with helm'
|
||||
- '--label=org.opencontainers.image.source={{.GitURL}}'
|
||||
- '--label=org.opencontainers.image.url={{.GitURL}}'
|
||||
- '--label=org.opencontainers.image.documentation={{.GitURL}}'
|
||||
@ -104,6 +104,7 @@ docker_manifests:
|
||||
image_templates:
|
||||
- 'foomo/squadron:{{ .Version }}-amd64'
|
||||
- 'foomo/squadron:{{ .Version }}-arm64'
|
||||
skip_push: auto
|
||||
|
||||
- name_template: 'foomo/squadron:{{ .Major }}'
|
||||
image_templates:
|
||||
|
||||
31
Dockerfile
31
Dockerfile
@ -1,31 +1,12 @@
|
||||
FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install git and ca-certificates
|
||||
RUN apk add --no-cache git ca-certificates
|
||||
|
||||
# Copy go mod files
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
# Download dependencies
|
||||
RUN go mod download
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build the Go application
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -trimpath -tags=safe -o /usr/bin/squadron ./cmd/main.go
|
||||
|
||||
# Stage 3: Final image
|
||||
FROM alpine:latest
|
||||
|
||||
RUN adduser -D -u 12345 -g 12345 squadron
|
||||
COPY --from=builder /usr/bin/squadron /usr/bin/squadron
|
||||
RUN apk --no-cache add ca-certificates
|
||||
|
||||
USER 12345
|
||||
RUN adduser -D -u 1001 -g 1001 squadron
|
||||
|
||||
COPY squadron /usr/bin/
|
||||
|
||||
USER squadron
|
||||
WORKDIR /home/squadron
|
||||
|
||||
ENTRYPOINT ["squadron"]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user