47 lines
1.6 KiB
Docker
Executable File
47 lines
1.6 KiB
Docker
Executable File
# Dockerfile
|
|
|
|
# Stage 1: Build the Quartz site
|
|
FROM node:lts-slim AS builder
|
|
|
|
# Create a non-root user to own files and run npm commands
|
|
USER node
|
|
WORKDIR /home/node/app
|
|
|
|
# Copy the locally cloned Quartz source code from the build context
|
|
# This 'quartz' dir is expected to be in the build context root,
|
|
# prepared by the update_quartz_docker.sh script.
|
|
COPY --chown=node:node quartz/ .
|
|
|
|
# Install dependencies based on the cloned Quartz source's package.json
|
|
RUN npm ci
|
|
|
|
# Now, copy your specific custom configuration files and the prepared content
|
|
# from the root of your deployment repo (the build context's root)
|
|
# into the current WORKDIR (/home/node/app), overwriting any placeholders
|
|
# from the cloned Quartz source if they share the same names/paths.
|
|
COPY --chown=node:node quartz.config.ts ./quartz.config.ts
|
|
COPY --chown=node:node quartz.layout.ts ./quartz.layout.ts
|
|
|
|
# Copy your custom overrides.
|
|
# This copies the contents of 'quartz_overrides/' from your deployment repo
|
|
# into /home/node/app/, overlaying any matching paths from the original framework.
|
|
COPY --chown=node:node quartz_overrides/ .
|
|
|
|
# Copy the Obsidian content prepared by the host script into ./content
|
|
COPY --chown=node:node content/ ./content/
|
|
|
|
# Build the Quartz site
|
|
RUN npx quartz build
|
|
# Output is expected in /home/node/app/public
|
|
|
|
# Stage 2: Serve the static files with NGINX
|
|
FROM nginx:alpine
|
|
|
|
RUN rm /etc/nginx/conf.d/default.conf
|
|
COPY custom_nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Adjust source path for public files from the builder stage
|
|
COPY --from=builder /home/node/app/public /usr/share/nginx/html
|
|
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"] |