fix: Dockerfile.website - proper multi-stage build for blog generation
This commit is contained in:
@@ -1,26 +1,16 @@
|
||||
FROM node:20-alpine
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
WORKDIR /app/www
|
||||
COPY www/package.json www/package-lock.json ./
|
||||
RUN npm install
|
||||
|
||||
# Install dependencies for blog build
|
||||
COPY www/package.json ./www/package.json
|
||||
RUN cd www && npm install --silent 2>/dev/null || true
|
||||
COPY www/ ./
|
||||
RUN node build-blog.js
|
||||
|
||||
# Copy www source files
|
||||
COPY www/ /app/www/
|
||||
FROM nginx:alpine
|
||||
|
||||
# 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 --from=builder /app/www/ /usr/share/nginx/html/
|
||||
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;"]
|
||||
|
||||
Reference in New Issue
Block a user