Files
kontor/kontor-echo/Containerfile
T
Thomas Peetz debdf3d0b0
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6s
Gitea Actions Demo / build-and-test (push) Failing after 11s
kontor-echo: setup project to show homepage
2026-11-09 17:02:59 +01:00

29 lines
1006 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 . .
ARG VERSION="dev"
ARG COMMIT="unset"
ARG DATE="unset"
# Build the Go application (strip debug info for smaller size)
RUN go build -trimpath -ldflags="-s -w -X kontor-api-echo/internal/globals.Version=${VERSION} -X kontor-api-echo/internal/globals.Commit=${COMMIT} -X kontor-api-echo/internal/globals.Date=${DATE}" -o kontor cmd/kontor-echo/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 /app/kontor
# Set the entrypoint command
ENTRYPOINT ["/app/kontor"]