Skip to content

Commit

Permalink
chore(Dockerfile): modify artifact handling to use USE_GORELEASER_ART…
Browse files Browse the repository at this point in the history
…IFACTS build arg (#50)

Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>
  • Loading branch information
aofei committed Mar 18, 2024
1 parent 2222ccc commit 97b6cc1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dockers:
use: buildx
build_flag_templates:
- --platform=linux/386
- --build-arg=USE_GORELEASER_ARTIFACTS=1
extra_files:
- ./
- goarch: amd64
Expand All @@ -42,6 +43,7 @@ dockers:
use: buildx
build_flag_templates:
- --platform=linux/amd64
- --build-arg=USE_GORELEASER_ARTIFACTS=1
extra_files:
- ./
- goarch: arm64
Expand All @@ -50,6 +52,7 @@ dockers:
use: buildx
build_flag_templates:
- --platform=linux/arm64
- --build-arg=USE_GORELEASER_ARTIFACTS=1
extra_files:
- ./
- goarch: arm
Expand All @@ -59,6 +62,7 @@ dockers:
use: buildx
build_flag_templates:
- --platform=linux/arm/v6
- --build-arg=USE_GORELEASER_ARTIFACTS=1
extra_files:
- ./
- goarch: arm
Expand All @@ -68,6 +72,7 @@ dockers:
use: buildx
build_flag_templates:
- --platform=linux/arm/v7
- --build-arg=USE_GORELEASER_ARTIFACTS=1
extra_files:
- ./
- goarch: ppc64le
Expand All @@ -76,6 +81,7 @@ dockers:
use: buildx
build_flag_templates:
- --platform=linux/ppc64le
- --build-arg=USE_GORELEASER_ARTIFACTS=1
extra_files:
- ./
- goarch: s390x
Expand All @@ -84,6 +90,7 @@ dockers:
use: buildx
build_flag_templates:
- --platform=linux/s390x
- --build-arg=USE_GORELEASER_ARTIFACTS=1
extra_files:
- ./

Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
FROM golang:1.22-alpine3.19 AS build

ARG USE_GORELEASER_ARTIFACTS=0

WORKDIR /usr/local/src/goproxy
COPY . .

RUN set -eux; \
if [ -d dist ]; then \
if [ $USE_GORELEASER_ARTIFACTS -eq 1 ]; then \
GOARCH=$(go env GOARCH); \
BIN_DIR=dist/goproxy_linux_$GOARCH; \
[ $GOARCH == "amd64" ] && BIN_DIR=${BIN_DIR}_v1; \
Expand Down

0 comments on commit 97b6cc1

Please sign in to comment.