2026-04-08 19:49:15 +02:00
|
|
|
# Stage 1: Build
|
2026-09-13 17:50:28 +02:00
|
|
|
# hugomods image bundles Hugo Extended + Node at matching, tested versions —
|
|
|
|
|
# Hugo's css.TailwindCSS execs node_modules/.bin/tailwindcss during the build,
|
|
|
|
|
# and pnpm-workspace.yaml's preferSymlinkedExecutables makes that a plain
|
|
|
|
|
# symlink Hugo's exec-security check accepts (see layouts/partials/head.html).
|
|
|
|
|
FROM hugomods/hugo:debian-node-0.165.0 AS builder
|
2026-04-08 19:49:15 +02:00
|
|
|
|
2026-09-13 17:50:28 +02:00
|
|
|
# Install FFmpeg (video compression)
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg && rm -rf /var/lib/apt/lists/*
|
2026-04-08 19:49:15 +02:00
|
|
|
|
|
|
|
|
# Install pnpm
|
2026-09-13 17:50:28 +02:00
|
|
|
RUN npm install -g pnpm
|
2026-04-08 19:49:15 +02:00
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Copy package files first (for layer caching)
|
2026-09-13 17:50:28 +02:00
|
|
|
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
2026-04-08 19:49:15 +02:00
|
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
|
|
|
|
|
|
# Copy source files
|
|
|
|
|
COPY . .
|
|
|
|
|
|
2026-04-11 18:42:57 +02:00
|
|
|
# Compress MP4 videos in-place before Hugo builds
|
|
|
|
|
RUN sh scripts/compress-videos.sh content
|
|
|
|
|
|
2026-04-08 19:49:15 +02:00
|
|
|
# Build CSS and Hugo site
|
|
|
|
|
RUN pnpm build
|
|
|
|
|
|
|
|
|
|
# Stage 2: Production
|
|
|
|
|
FROM nginx:alpine
|
|
|
|
|
|
|
|
|
|
# Copy built site
|
|
|
|
|
COPY --from=builder /app/public /usr/share/nginx/html
|
|
|
|
|
|
|
|
|
|
# Copy nginx config
|
|
|
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
|
|
|
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|