This commit is contained in:
2026-01-03 14:16:16 -08:00
commit 1f0e678d47
71 changed files with 16127 additions and 0 deletions

37
backend/Dockerfile Normal file
View File

@@ -0,0 +1,37 @@
# Build stage
FROM golang:1.24-alpine AS builder
WORKDIR /app
# Install git for fetching dependencies
RUN apk add --no-cache git ca-certificates
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o /api ./cmd/api
# Final stage
FROM alpine:3.19
WORKDIR /app
# Install ca-certificates for HTTPS requests
RUN apk --no-cache add ca-certificates tzdata
# Copy binary from builder (migrations are embedded in the binary)
COPY --from=builder /api /app/api
# Non-root user
RUN adduser -D -g '' appuser
RUN chown -R appuser:appuser /app
USER appuser
EXPOSE 8080
CMD ["/app/api"]