dockerize

This commit is contained in:
2025-08-08 17:47:16 +02:00
parent bf40237ba6
commit c44a449a7b
7 changed files with 150 additions and 40 deletions

23
Dockerfile Normal file
View File

@@ -0,0 +1,23 @@
FROM golang:1.24.5-alpine AS builder
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go generate ./...
RUN go build -ldflags="-w -s" -o /pastebin .
FROM gcr.io/distroless/static-debian12
COPY --from=builder --chown=nonroot:nonroot /pastebin /pastebin
COPY --from=builder --chown=nonroot:nonroot /app/view/style.css /view/style.css
USER nonroot:nonroot
EXPOSE 3000
ENTRYPOINT ["/pastebin"]