add Dockerfile and docker-compose for multi-stage build; update .gitignore and various HTML examples

This commit is contained in:
Elmar Kresse
2025-12-28 15:50:59 +01:00
parent 49a1ef45da
commit 0d376597d6
10 changed files with 189 additions and 23 deletions

24
Dockerfile Normal file
View File

@@ -0,0 +1,24 @@
# Multi-stage Dockerfile for Go (PocketBase) project
# --- Build Stage ---
FROM golang:1.21-alpine AS builder
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o server main.go
# --- Development Stage ---
FROM golang:1.21-alpine AS dev
WORKDIR /app
COPY --from=builder /app /app
EXPOSE 8080
CMD ["go", "run", "main.go"]
# --- Production Stage ---
FROM alpine:3.18 AS prod
WORKDIR /app
COPY --from=builder /app/server /app/server
COPY pb_public /app/pb_public
EXPOSE 8080
CMD ["/app/server"]