-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile
32 lines (26 loc) · 905 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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, python scripts ##
FROM python:3-slim AS scripts
COPY scripts/cleanup.py /cleanup.py
WORKDIR /
## Runtime stage, debug variant ##
FROM --platform=${TARGETPLATFORM} gcr.io/distroless/static-debian${DEBIAN_VERSION}:debug-nonroot AS debug
COPY --from=builder /build/rageshake /rageshake
WORKDIR /
EXPOSE 9110
ENTRYPOINT ["/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"]