Files
api-golang/Dockerfile
Flavio Fois 6c8b400a4a add docker configuration and gitea workflow for automated image builds
Introduce a multi-stage Dockerfile, docker-compose setup, and a Gitea Actions workflow to automate building and pushing images to the registry. The configuration includes an entrypoint script for persistent logging and a .dockerignore to optimize the build context.
2026-03-23 11:09:25 +01:00

29 lines
630 B
Docker

# --- Build stage ---
FROM golang:alpine AS builder
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o emly-api .
# --- Runtime stage ---
FROM alpine:latest
RUN apk --no-cache add ca-certificates tzdata
WORKDIR /app
COPY --from=builder /build/emly-api .
COPY --from=builder /build/internal/database/schema ./internal/database/schema
COPY --from=builder /build/internal/handlers/templates ./internal/handlers/templates
COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
RUN mkdir -p /logs
EXPOSE 8080
ENTRYPOINT ["/entrypoint.sh"]