36 lines
765 B
Docker
36 lines
765 B
Docker
# Stage 1: Build Quartz site
|
|
FROM node:22-slim AS builder
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
# Copy package files
|
|
COPY package.json package-lock.json* ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build Quartz (this generates the static site in /public)
|
|
RUN npx quartz build
|
|
|
|
# Stage 2: Serve with Nginx
|
|
FROM nginx:alpine
|
|
|
|
# Copy the built static files from builder stage
|
|
COPY --from=builder /usr/src/app/public /usr/share/nginx/html
|
|
|
|
# Copy custom nginx configuration
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Expose port 80
|
|
EXPOSE 80
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://localhost/ || exit 1
|
|
|
|
# Start nginx
|
|
CMD ["nginx", "-g", "daemon off;"]
|