health
This commit is contained in:
parent
921d51b97c
commit
b63ae2ba43
|
|
@ -0,0 +1,49 @@
|
|||
# ---- Builder Stage ----
|
||||
FROM golang:1.25.1-bookworm AS builder
|
||||
|
||||
# Build Args
|
||||
ARG BUILD_COMMAND="go build -o app ."
|
||||
ARG BINARY_NAME="app"
|
||||
ARG CGO_ENABLED="0"
|
||||
|
||||
# Env setup
|
||||
ENV CGO_ENABLED=${CGO_ENABLED}
|
||||
|
||||
# Setup workdir
|
||||
WORKDIR /build
|
||||
|
||||
# Copy go.mod and go.sum first to leverage caching
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy the rest of the source
|
||||
COPY . .
|
||||
|
||||
# Build with Go build cache (requires BuildKit)
|
||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||
--mount=type=cache,target=/root/.cache/go-build \
|
||||
${BUILD_COMMAND}
|
||||
|
||||
# ---- Runner Stage ----
|
||||
FROM debian:bookworm-slim AS runner
|
||||
|
||||
# Install minimal runtime dependencies (e.g. for TLS, CA certs)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Build Args
|
||||
ARG BINARY_NAME="app"
|
||||
|
||||
# Setup workdir
|
||||
WORKDIR /user
|
||||
|
||||
# Copy binary and config files
|
||||
COPY --from=builder /build/${BINARY_NAME} ./app
|
||||
COPY config.yaml .
|
||||
COPY db.yaml .
|
||||
COPY ui.html .
|
||||
|
||||
# Run binary directly
|
||||
ENTRYPOINT ["./app"]
|
||||
Loading…
Reference in New Issue