fix docker

This commit is contained in:
2026-04-21 06:15:10 +02:00
parent 6f8146c8bf
commit 7f4eb7d5da
5 changed files with 18 additions and 17 deletions
+6 -13
View File
@@ -1,21 +1,14 @@
FROM golang:1.25.1-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 .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o pastebin .
FROM alpine:latest
RUN apk --no-cache add ca-certificates
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
RUN mkdir /data && chown appuser:appgroup /data
USER appuser
COPY --from=builder /pastebin /pastebin
COPY --from=builder /app/view/style.css /view/style.css
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /app/pastebin /pastebin
COPY --from=builder /app/view /view
EXPOSE 3000
VOLUME /data
ENTRYPOINT ["/pastebin", "-db-path=/data/pastebin.db"]
ENTRYPOINT ["/pastebin", "-addr", ":3000", "-db-path", "/data/pastebin.db"]