diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index febbb98..7709630 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ on: tags: - "v[0-9]+.[0-9]+.[0-9]+" concurrency: - group: ${{ github.workflow }} + group: ${{ github.workflow }}-${{ github.ref_type }} cancel-in-progress: true jobs: main: @@ -27,6 +27,10 @@ jobs: go-version-file: go.mod cache: false check-latest: true + - name: Set Go Environment Variables + run: | + echo "GOOS=$(go env GOOS)" >> $GITHUB_ENV + echo "GOARCH=$(go env GOARCH)" >> $GITHUB_ENV - name: Tidy run: make tidy - name: Build @@ -80,6 +84,9 @@ jobs: context: . file: Dockerfile no-cache: true + build-args: | + GOOS: ${{ env.GOOS }} + GOARCH: ${{ env.GOARCH }} tags: | ghcr.io/${{ github.repository }}/ingest:latest labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 7e4df3e..40d7939 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,8 +18,14 @@ RUN go mod download -x COPY --chown=nonroot:nonroot . . +ARG GOOS=linux + +ARG GOARCH=amd64 + RUN make build +RUN mv ./bin/ingest_${GOOS}_${GOARCH} ./bin/ingest + FROM gcr.io/distroless/base-debian11:nonroot COPY --from=build --chown=nonroot:nonroot /home/nonroot/bin/ingest ingest