4f6855b733
Also allows it to run as non-root and set the rageshake binary as the entrypoint rather than setting the command. Signed-off-by: Quentin Gliech <quenting@element.io>
20 lines
546 B
Docker
20 lines
546 B
Docker
ARG GO_VERSION=1.17
|
|
ARG DEBIAN_VERSION=11
|
|
ARG DEBIAN_VERSION_NAME=bullseye
|
|
|
|
# Build stage
|
|
FROM --platform=${BUILDPLATFORM} docker.io/library/golang:${GO_VERSION}-${DEBIAN_VERSION_NAME} as builder
|
|
|
|
WORKDIR /build
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o rageshake
|
|
|
|
# Runtime stage
|
|
FROM --platform=${TARGETPLATFORM} gcr.io/distroless/static-debian${DEBIAN_VERSION}:nonroot
|
|
COPY --from=builder /build/rageshake /rageshake
|
|
WORKDIR /
|
|
EXPOSE 9110
|
|
ENTRYPOINT ["/rageshake"]
|