Files
kontor/kontor-gin/Containerfile
T
Thomas Peetz a0ad4e5c26
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5s
change kontor-gin for containers
2026-09-23 17:09:48 +02:00

28 lines
1003 B
Docker

# ---------- Stage 1: Build ----------
FROM docker.io/library/golang:1.26-alpine AS builder
# Set the working directory
WORKDIR /app
# Ensure a portable, static-ish binary
ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64
# Copy and download dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy the source code
COPY . .
# Build the Go application (strip debug info for smaller size)
RUN go build -trimpath -ldflags="-s -w" -o kontor-gin cmd/kontor-gin/main.go
# ---------- Stage 2: Final ----------
FROM alpine:latest
# Set the working directory
WORKDIR /app
# Install runtime dependencies you actually need
RUN apk add --no-cache ca-certificates tzdata curl
# Copy the binary and set ownership
COPY --from=builder /app/kontor-gin /app/kontor-gin
COPY --from=builder /app/templates /app/templates
COPY --from=builder /app/assets /app/assets
ENV DB_HOST=postgres DB_USER=kontor DB_PASSWORD=kontor DB_NAME=kontor DB_PORT=5432 GIN_MODE=release
# Set the entrypoint command
ENTRYPOINT ["/app/kontor-gin"]