35 lines
602 B
Docker
35 lines
602 B
Docker
# --- Build Stage ---
|
|
FROM golang:1.23-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install build dependencies
|
|
RUN apk add --no-cache git
|
|
|
|
# Download dependencies
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy source and data
|
|
COPY cmd/ ./cmd/
|
|
COPY pkg/ ./pkg/
|
|
|
|
# Build the binary
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o /toolbox cmd/toolbox/main.go
|
|
|
|
# --- Final Stage ---
|
|
FROM alpine:latest
|
|
|
|
# Basic security & CA certs
|
|
RUN apk --no-cache add ca-certificates tzdata
|
|
WORKDIR /root/
|
|
|
|
# Copy binary from builder
|
|
COPY --from=builder /toolbox .
|
|
|
|
# Default environment
|
|
ENV PORT=8080
|
|
EXPOSE 8080
|
|
|
|
CMD ["./toolbox"]
|