File tree 4 files changed +50
-17
lines changed
4 files changed +50
-17
lines changed Original file line number Diff line number Diff line change 8
8
runs-on : ubuntu-latest
9
9
steps :
10
10
- uses : actions/checkout@v3
11
+
12
+ - name : Set up QEMU
13
+ uses : docker/setup-qemu-action@v2
14
+
11
15
- name : Set up Docker Buildx
12
16
uses : docker/setup-buildx-action@v2
17
+ with :
18
+ platforms : linux/amd64,linux/arm64
19
+
13
20
- name : Login to Docker Hub
14
21
uses : docker/login-action@v2
15
22
with :
16
23
username : ${{ secrets.DOCKER_USER }}
17
24
password : ${{ secrets.DOCKER_PASSWORD }}
18
- - name : Build and push canary tag
19
- uses : docker/build-push-action@v4
20
- with :
21
- file : cmd/proxy/Dockerfile
22
- build-args : VERSION=${{github.sha}}
23
- tags : gomods/athens:canary
24
- push : true
25
+
25
26
- name : Set Short SHA
26
27
id : vars
27
28
run : echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
28
- - name : Build and push commit tag
29
+
30
+ - name : Build and push images
29
31
uses : docker/build-push-action@v4
30
32
with :
31
33
file : cmd/proxy/Dockerfile
32
- build-args : VERSION=${{github.sha}}
33
- tags : gomods/athens-dev:${{ steps.vars.outputs.sha_short }}
34
+ build-args : VERSION=${{ github.sha }}
35
+ tags : gomods/athens:canary,gomods/athens -dev:${{ steps.vars.outputs.sha_short }}
34
36
push : true
37
+ platforms : linux/amd64,linux/arm64
Original file line number Diff line number Diff line change 8
8
runs-on : ubuntu-latest
9
9
steps :
10
10
- uses : actions/checkout@v3
11
+
12
+ - name : Set up QEMU
13
+ uses : docker/setup-qemu-action@v2
14
+
11
15
- name : Set up Docker Buildx
12
16
uses : docker/setup-buildx-action@v2
17
+ with :
18
+ platforms : linux/amd64,linux/arm64
19
+
13
20
- name : Login to Docker Hub
14
21
uses : docker/login-action@v2
15
22
with :
16
23
username : ${{ secrets.DOCKER_USER }}
17
24
password : ${{ secrets.DOCKER_PASSWORD }}
18
- - name : Build and push latest tag
25
+
26
+ - name : Docker meta
27
+ id : meta
28
+ uses : docker/metadata-action@v4
29
+ with :
30
+ images : |
31
+ gomods/athens
32
+ tags : |
33
+ type=raw,value=${{ github.ref_name }}
34
+ type=raw,value=latest
35
+
36
+ - name : Build and push images
19
37
uses : docker/build-push-action@v4
20
38
with :
21
39
file : cmd/proxy/Dockerfile
22
40
build-args : VERSION=${{ github.ref_name }}
23
- tags : gomods/athens:latest,gomods/athens:${{ github.ref_name }}
41
+ tags : ${{ steps.meta.outputs.tags }}
42
+ labels : ${{ steps.meta.outputs.labels }}
24
43
push : true
44
+ platforms : linux/amd64,linux/arm64
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ builds:
12
12
- darwin
13
13
goarch :
14
14
- amd64
15
+ - arm64
15
16
main : cmd/proxy/main.go
16
17
binary : athens
17
18
ldflags :
Original file line number Diff line number Diff line change 8
8
ARG GOLANG_VERSION=1.20
9
9
ARG ALPINE_VERSION=3.17
10
10
11
- FROM golang:${GOLANG_VERSION}-alpine AS builder
11
+ FROM --platform=$BUILDPLATFORM golang:${GOLANG_VERSION}-alpine AS builder
12
+
13
+ ARG VERSION="unset" \
14
+ TARGETARCH
15
+
16
+ ENV GOARCH=${TARGETARCH} \
17
+ GO111MODULE=on \
18
+ CGO_ENABLED=0 \
19
+ GOPROXY="https://proxy.golang.org"
12
20
13
21
WORKDIR $GOPATH/src/github.com/gomods/athens
14
22
15
23
COPY . .
16
24
17
- ARG VERSION="unset"
18
-
19
- RUN DATE="$(date -u +%Y-%m-%d-%H:%M:%S-%Z)" && GO111MODULE=on CGO_ENABLED=0 GOPROXY="https://proxy.golang.org" go build -ldflags "-X github.com/gomods/athens/pkg/build.version=$VERSION -X github.com/gomods/athens/pkg/build.buildDate=$DATE -s -w" -o /bin/athens-proxy ./cmd/proxy
25
+ RUN DATE="$(date -u +%Y-%m-%d-%H:%M:%S-%Z)" && \
26
+ go build \
27
+ -ldflags "-X github.com/gomods/athens/pkg/build.version=$VERSION -X github.com/gomods/athens/pkg/build.buildDate=$DATE -s -w" \
28
+ -o /bin/athens-proxy ./cmd/proxy
20
29
21
30
FROM alpine:${ALPINE_VERSION}
22
31
@@ -30,7 +39,7 @@ RUN chmod 644 /config/config.toml
30
39
31
40
# Add tini, see https://github.com/gomods/athens/issues/1155 for details.
32
41
RUN apk add --update git git-lfs mercurial openssh-client subversion procps fossil tini && \
33
- mkdir -p /usr/local/go
42
+ mkdir -p /usr/local/go
34
43
35
44
ARG USER=athens
36
45
RUN adduser -D -h /home/$USER $USER
You can’t perform that action at this time.
0 commit comments