# Stage 1: Build the Quartz site FROM node:lts-slim AS builder WORKDIR /app # Copy package.json and package-lock.json (or yarn.lock) COPY package*.json ./ # Install dependencies RUN npm i # Copy the rest of the Quartz project files COPY . . # Build the Quartz site (adjust if your build command is different) # This usually outputs to a 'public' directory RUN npx quartz build # ---- START DEBUG ---- RUN echo "Listing contents of /app/public after build:" && ls -lA /app/public RUN echo "Checking for /app/public/index.html:" && \ if [ -f /app/public/index.html ]; then \ echo "index.html found. First few lines:"; \ head -n 10 /app/public/index.html; \ else \ echo "index.html NOT FOUND in /app/public!"; \ fi # ---- END DEBUG ---- # Stage 2: Serve the static files with NGINX FROM nginx:alpine # Remove default NGINX configuration RUN rm /etc/nginx/conf.d/default.conf # Copy custom NGINX configuration from your project COPY custom_nginx.conf /etc/nginx/conf.d/default.conf # Copy only the built static files from the 'builder' stage's 'public' folder COPY --from=builder /app/public /usr/share/nginx/html EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]