Files
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

44 lines
998 B
Docker

FROM golang:1.26.8-alpine AS builder
ENV GOTOOLCHAIN=auto
# Install git and other build dependencies
RUN apk add --no-cache git make
# 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 s3 binaries without CGO
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -o s3 ./s3/
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -o s3-db ./cmd/s3-db
# Final stage - minimal runtime image
FROM alpine:latest
# Install ca-certificates for HTTPS calls and netcat for health checks
RUN apk --no-cache add ca-certificates netcat-openbsd curl
WORKDIR /root/
# Copy the binaries from builder stage
COPY --from=builder /app/s3 .
COPY --from=builder /app/s3-db .
# Make it executable
RUN chmod +x ./s3 ./s3-db
# Expose ports
EXPOSE 9333 8888 8333 8085 9533 5432
# Create data directory
RUN mkdir -p /data
# Default command (can be overridden)
CMD ["./s3", "server", "-dir=/data"]