-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (30 loc) · 968 Bytes
/
Dockerfile
File metadata and controls
43 lines (30 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Multi-stage Dockerfile for MkDocs
# Stage 1: Build stage
FROM python:3.12-slim AS builder
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Set working directory
WORKDIR /app
# Copy dependency files
COPY pyproject.toml uv.lock ./
# Install dependencies using uv
RUN uv sync --frozen --no-dev
# Copy project files
COPY . .
# Build the MkDocs site
RUN uv run mkdocs build --strict --site-dir /app/site
# Stage 2: Production stage - serve built site
FROM nginx:alpine
# Copy built site from builder stage
COPY --from=builder /app/site /usr/share/nginx/html
# Copy nginx configuration (optional, uses default if not provided)
# Uncomment and customize if needed:
# COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80
EXPOSE 80
# Start nginx
CMD ["nginx", "-g", "daemon off;"]