diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-08-17 13:38:15 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-08-17 13:47:36 +0200 |
| commit | 5384d0431af2242a13553da7456677238b3726a7 (patch) | |
| tree | 8bde21957dedb1757e73900f4febb9b838a7c13a /Dockerfile | |
| parent | 8af00445f3bcfbaedb14792b4e2304a2b2470cce (diff) | |
feat: deploy by docker on vps
Diffstat (limited to 'Dockerfile')
| -rw-r--r-- | Dockerfile | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e7aeed9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM golang:1.25-alpine AS builder + +WORKDIR /src + +COPY go.mod go.sum ./ +RUN go mod download + +COPY . . +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ + go build -trimpath -ldflags="-s -w" -o /out/gallery . + +FROM alpine:3.22 + +RUN addgroup -S -g 1000 app && adduser -S -D -u 1000 -G app app + +WORKDIR /app +COPY --from=builder --chown=app:app /out/gallery /app/gallery +RUN mkdir /app/data && chown app:app /app/data + +VOLUME /app/data +EXPOSE 8020 +ENV HOME=/app +USER app +ENTRYPOINT ["/app/gallery"] +CMD ["serve", "--addr", ":8020", "--data", "/app/data"] |
