axiaoxin-com-investool
SUCCESS
3m 44s
History Source
SummaryIterations1Transcript3Dockerfile
Dockerfile32 lines · 611 chars
FROM golang:1.25.8-bookworm AS builder

WORKDIR /build

# Cache Go module downloads
COPY go.mod go.sum ./
RUN go mod download

# Copy source and build
COPY . .

# Build static binary suitable for Linux
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
RUN go build -o investool

# Runtime image
FROM alpine:3.23.3

WORKDIR /srv

# Install runtime certificates
RUN apk add --no-cache ca-certificates

# Copy built binary and config into the runtime image
COPY --from=builder /build/investool /srv/investool
COPY config.toml /srv/config.toml

EXPOSE 4869 4870
ENTRYPOINT ["./investool", "-c", "/srv/config.toml"]