docker compose
This commit is contained in:
27
Dockerfile
Normal file
27
Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
FROM golang:1.25.3 AS build-stage
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
RUN go mod download
|
||||
|
||||
COPY *.go ./
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o /app.bin
|
||||
|
||||
from build-stage AS run-tests-stage
|
||||
RUN go test -v ./
|
||||
|
||||
FROM gcr.io/distroless/base-debian11 AS build-release-stage
|
||||
|
||||
WORKDIR /
|
||||
|
||||
COPY --from=build-stage /app.bin /app.bin
|
||||
|
||||
EXPOSE ${LISTEN_PORT}/tcp
|
||||
|
||||
USER nonroot:nonroot
|
||||
|
||||
ENTRYPOINT ["/app.bin"]
|
||||
CMD ["-p", "${LISTEN_PORT}"]
|
||||
Reference in New Issue
Block a user