2022-01-20 16:13:13 +05:30
|
|
|
ARG GO_VERSION=1.17
|
|
|
|
ARG DEBIAN_VERSION=11
|
|
|
|
ARG DEBIAN_VERSION_NAME=bullseye
|
|
|
|
|
2022-01-21 15:50:13 +05:30
|
|
|
## Build stage ##
|
|
|
|
FROM --platform=${BUILDPLATFORM} docker.io/library/golang:${GO_VERSION}-${DEBIAN_VERSION_NAME} AS builder
|
2019-03-07 19:12:18 +05:30
|
|
|
|
|
|
|
WORKDIR /build
|
2022-01-20 16:13:13 +05:30
|
|
|
COPY go.mod go.sum ./
|
2019-03-07 19:12:18 +05:30
|
|
|
RUN go mod download
|
|
|
|
|
|
|
|
COPY . .
|
2022-01-20 16:13:13 +05:30
|
|
|
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o rageshake
|
2019-03-07 19:12:18 +05:30
|
|
|
|
2022-01-21 15:50:13 +05:30
|
|
|
## Runtime stage, debug variant ##
|
|
|
|
FROM --platform=${TARGETPLATFORM} gcr.io/distroless/static-debian${DEBIAN_VERSION}:debug-nonroot AS debug
|
|
|
|
COPY --from=builder /build/rageshake /rageshake
|
2022-01-21 16:03:35 +05:30
|
|
|
WORKDIR /
|
2022-01-21 15:50:13 +05:30
|
|
|
EXPOSE 9110
|
|
|
|
ENTRYPOINT ["/rageshake"]
|
|
|
|
|
|
|
|
## Runtime stage ##
|
2022-01-20 16:13:13 +05:30
|
|
|
FROM --platform=${TARGETPLATFORM} gcr.io/distroless/static-debian${DEBIAN_VERSION}:nonroot
|
2019-03-07 19:12:18 +05:30
|
|
|
COPY --from=builder /build/rageshake /rageshake
|
2022-01-21 16:03:35 +05:30
|
|
|
WORKDIR /
|
2019-03-07 19:12:18 +05:30
|
|
|
EXPOSE 9110
|
2022-01-20 16:13:13 +05:30
|
|
|
ENTRYPOINT ["/rageshake"]
|