rexforge/container/Containerfile
2025-01-28 12:24:00 +01:00

25 lines
522 B
Docker

FROM docker.io/golang:alpine as go
RUN apk add make
WORKDIR /build
# ADD rex_server/go.mod rex_server/go.sum ./ # WARNING: Include go.sum
ADD rex_server/go.mod ./
RUN go mod download
# Add the rest of the source
ADD . .
RUN make -C rex_server
# Runner image, drop privileges
FROM docker.io/alpine:latest as runner
RUN adduser -D nonroot
RUN addgroup nonroot nonroot
WORKDIR /app
RUN chown nonroot:nonroot /app
COPY --from=go /build/rex_server/rexserver rexserver
EXPOSE 8080
USER nonroot:nonroot
CMD ["./rexserver"]