-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Docker image build and publish workflow for ARM64 architecture
- Loading branch information
1 parent
7844d68
commit a1ec5c0
Showing
1 changed file
with
11 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,20 @@ | ||
FROM golang:1.23-bullseye AS deps | ||
FROM golang:1.23-alpine AS builder | ||
|
||
WORKDIR /app | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
FROM golang:1.23-bullseye AS build | ||
|
||
WORKDIR /app | ||
COPY --from=deps /go/pkg/mod /go/pkg/mod | ||
COPY . . | ||
RUN apt-get update && apt-get install -y gcc g++ | ||
ENV CGO_ENABLED=1 \ | ||
GOOS=linux \ | ||
GOARCH=arm64 | ||
RUN --mount=type=cache,target=/var/cache/apk \ | ||
apk update && \ | ||
apk add gcc g++ && \ | ||
CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -o /app/sentinel ./ | ||
|
||
RUN go build -o /app/bin/sentinel ./ | ||
FROM alpine:latest | ||
RUN --mount=type=cache,target=/var/cache/apk \ | ||
apk update && \ | ||
apk add ca-certificates curl | ||
|
||
FROM debian:bullseye-slim | ||
RUN apt-get update && apt-get install -y ca-certificates curl && rm -rf /var/lib/apt/lists/* | ||
ENV GIN_MODE=release | ||
COPY --from=build /app/ /app | ||
COPY --from=build /app/bin/sentinel /app/sentinel | ||
CMD ["/app/sentinel"] | ||
COPY --from=builder /app/sentinel /app/sentinel | ||
CMD ["/app/sentinel"] |