File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,22 +14,17 @@ jobs:
1414 - name : Checkout code
1515 uses : actions/checkout@v4
1616
17- - name : Set up Docker Buildx
18- uses : docker/setup-buildx-action@v3
19-
2017 - name : Log in to GitHub Container Registry
2118 uses : docker/login-action@v3
2219 with :
2320 registry : ghcr.io
2421 username : ${{ github.actor }}
2522 password : ${{ secrets.GHCR_TOKEN }}
2623
27- - name : Build and push multiarch image
28- env :
29- SHORT_SHA : ${{ github.sha }}
24+ - name : Build and push image
3025 run : |
31- SHORT_SHA=${SHORT_SHA ::7}
32- docker buildx build \
33- --platform linux/amd64,linux/arm64/v8 --push \
34- -t ghcr.io/voidcontests/api:$SHORT_SHA \
35- -t ghcr.io/voidcontests/api:latest .
26+ SHORT_SHA=${GITHUB_SHA ::7}
27+ docker build -t ghcr.io/voidcontests/api:$SHORT_SHA \
28+ -t ghcr.io/voidcontests/api:latest .
29+ docker push ghcr.io/voidcontests/api:$SHORT_SHA
30+ docker push ghcr.io/voidcontests/api:latest
Original file line number Diff line number Diff line change 1- FROM --platform=$BUILDPLATFORM golang:1.25.1-alpine3.22 AS builder
2-
3- ARG TARGETOS
4- ARG TARGETARCH
1+ FROM golang:1.25.1-alpine3.22 AS builder
52
63WORKDIR /app
74
@@ -11,8 +8,7 @@ COPY go.mod go.sum ./
118RUN go mod download
129
1310COPY . .
14- RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
15- go build -a -ldflags "-w -s \
11+ RUN go build -a -ldflags "-w -s \
1612 -X github.com/voidcontests/api/internal/version.GIT_COMMIT=$(git rev-parse --short HEAD) \
1713 -X github.com/voidcontests/api/internal/version.GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" \
1814 -o build/api ./cmd/api
You can’t perform that action at this time.
0 commit comments