Files
blog/Dockerfile
T
venus 1491d3fa5c feat: make SITE_URL and SITE_DOMAIN dynamic via .env and docker compose
- Create .env and .env.example with SITE_DOMAIN=riverrooks.dev and SITE_URL=https://riverrooks.dev
- Migrate src/_data/site.json to src/_data/site.js reading environment variables dynamically
- Update subdomains across Forgejo, CyberChef, Stirling PDF, and Uptime Kuma to inherit site.domain
- Update docker-compose.yml and Dockerfile to accept dynamic SITE_URL and SITE_DOMAIN build args
- Add .env to .gitignore
2026-09-13 01:10:20 -05:00

36 lines
854 B
Docker

# Stage 1: Build static site with Node
FROM node:22-alpine AS builder
WORKDIR /app
# Dynamic build arguments for domain & full URL
ARG SITE_URL=https://riverrooks.dev
ARG SITE_DOMAIN=riverrooks.dev
ENV SITE_URL=$SITE_URL
ENV SITE_DOMAIN=$SITE_DOMAIN
# Copy dependency definitions and install
COPY package*.json ./
RUN npm ci
# Copy source files and compile static output via Eleventy
COPY . .
RUN npm run build
# Stage 2: Serve static output via lightweight Alpine Nginx
FROM nginx:1.25-alpine
# Remove default Nginx configuration
RUN rm /etc/nginx/conf.d/default.conf
# Copy custom Nginx security & clean-URL configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy compiled static website files from builder stage
COPY --from=builder /app/_site /usr/share/nginx/html
# Expose HTTP port
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]