Files

36 lines
1.1 KiB
Docker
Raw Permalink Normal View History

# ── Stage 1: builder ────────────────────────────────────────────────────────
FROM node:22-alpine AS builder
# Install Hugo extended + build tools
RUN apk add --no-cache \
curl \
git \
libc6-compat \
&& HUGO_VERSION=0.147.2 \
&& curl -sSL "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz" \
| tar -xz -C /usr/local/bin hugo
# Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app
# Install dependencies
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile
# Copy source
COPY . .
# Build site
RUN NODE_ENV=production hugo --minify
# ── Stage 2: production (nginx) ──────────────────────────────────────────────
FROM nginx:alpine AS production
COPY --from=builder /app/public /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]