# Build stage FROM golang:1.23-alpine AS builder RUN apk add --no-cache gcc musl-dev sqlite-dev WORKDIR /app COPY go.mod go.sum ./ RUN go mod download COPY . . RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -o server cmd/server/main.go # Runtime stage FROM alpine:latest RUN apk --no-cache add ca-certificates sqlite-libs WORKDIR /app COPY --from=builder /app/server . COPY --from=builder /app/web ./web VOLUME ["/data"] ENV DATABASE_PATH=/data/dyn.db \ SERVER_PORT=8080 \ RATE_LIMIT_PER_IP=10 \ RATE_LIMIT_PER_TOKEN=1 EXPOSE 8080 CMD ["./server"]