# Stage 1: Build the static site using MkDocs
FROM python:3.9-slim-buster as builder

# Set the working directory
WORKDIR /app

# Copy the requirements file
COPY requirements.txt .

# Install the Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application files
COPY ../.. .

# Build the MkDocs site
RUN mkdocs build


# Stage 2: Serve the static files with Nginx
FROM nginx:alpine

# Copy the built site from the builder stage
COPY --from=builder /app/site /usr/share/nginx/html

# Expose port 80 for the web server
EXPOSE 80

# Command to run Nginx in the foreground
CMD ["nginx", "-g", "daemon off;"]
