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/ ./
|
||||||
COPY www/package.json ./www/package.json
|
RUN node build-blog.js
|
||||||
RUN cd www && npm install --silent 2>/dev/null || true
|
|
||||||
|
|
||||||
# Copy www source files
|
FROM nginx:alpine
|
||||||
COPY www/ /app/www/
|
|
||||||
|
|
||||||
# Build blog (processes _posts/*.md to blog/*.html)
|
COPY --from=builder /app/www/ /usr/share/nginx/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/
|
COPY docker-entrypoint.d/ /docker-entrypoint.d/
|
||||||
RUN chmod +x /docker-entrypoint.d/*.sh
|
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;"]
|
ENTRYPOINT ["/docker-entrypoint.d/30-envsubst.sh", "--", "nginx", "-g", "daemon off;"]
|
||||||
|
|||||||
Reference in New Issue
Block a user