2024-10-19 21:59:24 +01:00
|
|
|
FROM golang:1.21 AS build_image
|
2023-01-08 09:26:04 +00:00
|
|
|
|
2024-01-29 11:53:36 +00:00
|
|
|
WORKDIR /usr/src/app
|
2023-01-08 09:26:04 +00:00
|
|
|
|
2024-01-29 11:53:36 +00:00
|
|
|
# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
|
|
|
|
COPY go.mod go.sum ./
|
2024-01-27 16:36:38 +00:00
|
|
|
RUN go mod download && go mod verify
|
2024-01-29 11:53:36 +00:00
|
|
|
|
|
|
|
COPY . .
|
2024-10-19 22:01:47 +01:00
|
|
|
|
|
|
|
# build binary, place into ./bin/
|
2024-10-19 21:59:24 +01:00
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o ./bin/q3rcon-proxy ./cmd/q3rcon-proxy/
|
|
|
|
|
|
|
|
FROM scratch AS final_image
|
|
|
|
|
|
|
|
WORKDIR /bin/
|
|
|
|
|
|
|
|
COPY --from=build_image /usr/src/app/bin/q3rcon-proxy .
|
2023-01-08 09:26:04 +00:00
|
|
|
|
|
|
|
# Command to run when starting the container
|
2024-10-19 21:59:24 +01:00
|
|
|
ENTRYPOINT [ "./q3rcon-proxy" ]
|