Add Go rewrite with Postgres 17 and Dokploy Docker Compose
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
# Multi-stage build optimized for Dokploy / docker compose.
|
||||
|
||||
FROM golang:1.22-alpine AS builder
|
||||
RUN apk add --no-cache git ca-certificates tzdata
|
||||
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/server ./cmd/server \
|
||||
&& go build -trimpath -ldflags="-s -w" -o /out/cleanup ./cmd/cleanup
|
||||
|
||||
FROM alpine:3.20
|
||||
RUN apk add --no-cache ca-certificates tzdata wget \
|
||||
&& addgroup -S app && adduser -S -G app app
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /out/server /app/server
|
||||
COPY --from=builder /out/cleanup /app/cleanup
|
||||
COPY migrations /app/migrations
|
||||
COPY web /app/web
|
||||
|
||||
ENV APP_PORT=30000 \
|
||||
TZ=UTC
|
||||
|
||||
USER app
|
||||
EXPOSE 30000
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
||||
CMD wget -qO- http://127.0.0.1:30000/health || exit 1
|
||||
|
||||
ENTRYPOINT ["/app/server"]
|
||||
Reference in New Issue
Block a user