Skip to content

Commit

Permalink
Have separate build arguments for ARCH and GOARCH
Browse files Browse the repository at this point in the history
  • Loading branch information
M. Mert Yildiran committed Jan 17, 2022
1 parent 5a81061 commit 0b6d949
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
fail-fast: false
matrix:
target:
- amd64
- arm64
- [amd64, amd64]
- [arm64v8, arm64]

steps:
- name: Check out the repo
Expand Down Expand Up @@ -53,7 +53,8 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
ARCH=${{ matrix.target }}
ARCH=${{ matrix.target[0] }}
GOARCH=${{ matrix.target[1] }}
github-registry:
name: Push Docker image to GitHub's Registry
Expand Down Expand Up @@ -95,7 +96,8 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
ARCH=${{ matrix.target }}
ARCH=${{ matrix.target[0] }}
GOARCH=${{ matrix.target[1] }}
docker-manifest:
name: Create and Push a Docker Manifest
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
ARG ARCH=
ARG GOARCH=
FROM golang:1.16-alpine AS builder
RUN apk add make perl-utils
WORKDIR /tmp
COPY server server
COPY Makefile .
RUN make build GOOS=linux GOARCH=${ARCH}
RUN make build GOOS=linux GOARCH=${GOARCH}

FROM ${ARCH}/alpine:3.15
COPY --from=builder ["/tmp/build/basenine_linux_${ARCH}", "./basenine"]
COPY --from=builder ["/tmp/build/basenine_linux_${GOARCH}", "./basenine"]
ENTRYPOINT "./basenine"

0 comments on commit 0b6d949

Please sign in to comment.