FROM node:20-alpine WORKDIR /app # Install dependencies for blog build COPY www/package.json ./www/package.json RUN cd www && npm install --silent 2>/dev/null || true # Copy www source files COPY www/ /app/www/ # Build blog (processes _posts/*.md to blog/*.html) RUN node www/build-blog.js # Run envsubst on HTML files RUN apk add --no-cache gettext && \ chmod +x /docker-entrypoint.d/*.sh 2>/dev/null || true # Copy entrypoint COPY docker-entrypoint.d/ /docker-entrypoint.d/ RUN chmod +x /docker-entrypoint.d/*.sh # Copy to nginx document root COPY --from=0 /app/www/ /usr/share/nginx/html/ ENTRYPOINT ["/docker-entrypoint.d/30-envsubst.sh", "--", "nginx", "-g", "daemon off;"]