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
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
|
with:
|
||||||
- name: Unshallow
|
fetch-depth: 0
|
||||||
run: git fetch --prune --unshallow
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
@ -26,7 +25,6 @@ jobs:
|
|||||||
|
|
||||||
- uses: docker/setup-buildx-action@v3
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
|
||||||
- id: app_token
|
- id: app_token
|
||||||
uses: tibdex/github-app-token@v2
|
uses: tibdex/github-app-token@v2
|
||||||
with:
|
with:
|
||||||
@ -38,7 +36,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: goreleaser/goreleaser-action@v6
|
- uses: goreleaser/goreleaser-action@v6
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: '~> v2'
|
||||||
args: release --clean
|
args: release --clean
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ steps.app_token.outputs.token }}
|
GITHUB_TOKEN: ${{ steps.app_token.outputs.token }}
|
||||||
|
|||||||
@ -29,10 +29,10 @@ builds:
|
|||||||
- -s -w -X github.com/foomo/squadron/cmd/actions.version={{.Version}}
|
- -s -w -X github.com/foomo/squadron/cmd/actions.version={{.Version}}
|
||||||
|
|
||||||
archives:
|
archives:
|
||||||
- format: tar.gz
|
- formats: [ tar.gz ]
|
||||||
format_overrides:
|
- format_overrides:
|
||||||
- goos: windows
|
- goos: windows
|
||||||
format: zip
|
formats: [ zip ]
|
||||||
|
|
||||||
changelog:
|
changelog:
|
||||||
use: github-native
|
use: github-native
|
||||||
@ -61,7 +61,7 @@ dockers:
|
|||||||
- '--pull'
|
- '--pull'
|
||||||
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
|
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
|
||||||
- '--label=org.opencontainers.image.title={{.ProjectName}}'
|
- '--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.source={{.GitURL}}'
|
||||||
- '--label=org.opencontainers.image.url={{.GitURL}}'
|
- '--label=org.opencontainers.image.url={{.GitURL}}'
|
||||||
- '--label=org.opencontainers.image.documentation={{.GitURL}}'
|
- '--label=org.opencontainers.image.documentation={{.GitURL}}'
|
||||||
@ -83,7 +83,7 @@ dockers:
|
|||||||
- '--pull'
|
- '--pull'
|
||||||
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
|
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
|
||||||
- '--label=org.opencontainers.image.title={{.ProjectName}}'
|
- '--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.source={{.GitURL}}'
|
||||||
- '--label=org.opencontainers.image.url={{.GitURL}}'
|
- '--label=org.opencontainers.image.url={{.GitURL}}'
|
||||||
- '--label=org.opencontainers.image.documentation={{.GitURL}}'
|
- '--label=org.opencontainers.image.documentation={{.GitURL}}'
|
||||||
@ -104,6 +104,7 @@ docker_manifests:
|
|||||||
image_templates:
|
image_templates:
|
||||||
- 'foomo/squadron:{{ .Version }}-amd64'
|
- 'foomo/squadron:{{ .Version }}-amd64'
|
||||||
- 'foomo/squadron:{{ .Version }}-arm64'
|
- 'foomo/squadron:{{ .Version }}-arm64'
|
||||||
|
skip_push: auto
|
||||||
|
|
||||||
- name_template: 'foomo/squadron:{{ .Major }}'
|
- name_template: 'foomo/squadron:{{ .Major }}'
|
||||||
image_templates:
|
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
|
FROM alpine:latest
|
||||||
|
|
||||||
RUN adduser -D -u 12345 -g 12345 squadron
|
RUN apk --no-cache add ca-certificates
|
||||||
COPY --from=builder /usr/bin/squadron /usr/bin/squadron
|
|
||||||
|
|
||||||
USER 12345
|
RUN adduser -D -u 1001 -g 1001 squadron
|
||||||
|
|
||||||
|
COPY squadron /usr/bin/
|
||||||
|
|
||||||
|
USER squadron
|
||||||
WORKDIR /home/squadron
|
WORKDIR /home/squadron
|
||||||
|
|
||||||
ENTRYPOINT ["squadron"]
|
ENTRYPOINT ["squadron"]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user