19 lines
602 B
Docker
19 lines
602 B
Docker
# --- Build step ---
|
|
FROM golang:1.22 AS build
|
|
WORKDIR /app
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 go build -o /blog ./cmd/blog
|
|
|
|
# --- Runtime + optional MySQL client libraries ---
|
|
FROM debian:bookworm-slim
|
|
RUN apt-get update && apt-get install -y default-mysql-client ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
COPY --from=build /blog /usr/local/bin/blog
|
|
COPY content/ /content
|
|
COPY internal/web/static/ /static
|
|
EXPOSE 8080
|
|
ENV BLOG_CONTENT_DIR=/content
|
|
ENV BLOG_STATIC_DIR=/static
|
|
CMD ["blog"]
|
|
|