Files
s3/test/postgres/Dockerfile.client
zeekayandHanzo Dev b375c1c798 go 1.26.8
One toolchain across the estate. The tree carried 1.26.0, .1, .3, .4 and .5
at once, so which compiler built a binary depended on which repo it came
from.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-08 23:57:31 -07:00

39 lines
782 B
Docker

FROM golang:1.26.8-alpine AS builder
ENV GOTOOLCHAIN=auto
# Set working directory
WORKDIR /app
# Copy go mod files first for better caching
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build the client
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o client ./test/postgres/client.go
# Final stage
FROM alpine:latest
# Install ca-certificates and netcat for health checks
RUN apk --no-cache add ca-certificates netcat-openbsd
WORKDIR /root/
# Copy the binary from builder stage
COPY --from=builder /app/client .
# Make it executable
RUN chmod +x ./client
# Set environment variables with defaults
ENV POSTGRES_HOST=localhost
ENV POSTGRES_PORT=5432
ENV POSTGRES_USER=hanzo
ENV POSTGRES_DB=default
# Run the client
CMD ["./client"]