Update Dockerfile
This commit is contained in:
parent
ebaad620c9
commit
11f8a96430
1 changed files with 29 additions and 10 deletions
39
Dockerfile
39
Dockerfile
|
|
@ -1,20 +1,39 @@
|
|||
# Use the official Python image as a base
|
||||
FROM python:3.11-slim
|
||||
# ───────────────────────────────────────────────────────
|
||||
# 1) Build stage: install MkDocs & compile your site
|
||||
# ───────────────────────────────────────────────────────
|
||||
FROM python:3.11-slim AS builder
|
||||
|
||||
# prevent interactive prompts
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Set the working directory in the container
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the requirements file if you have one
|
||||
# copy & install dependencies
|
||||
COPY requirements.txt .
|
||||
|
||||
# Install MkDocs and any other dependencies
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy the entire MkDocs project into the container
|
||||
# copy our doc sources & build
|
||||
COPY . .
|
||||
# note: if you need a custom config or extra flags, adjust here
|
||||
RUN mkdocs build --clean --site-dir /app/site
|
||||
|
||||
# Expose the port that MkDocs will run on
|
||||
|
||||
# ───────────────────────────────────────────────────────
|
||||
# 2) Run stage: serve the built site via nginx
|
||||
# ───────────────────────────────────────────────────────
|
||||
FROM nginx:alpine
|
||||
|
||||
# remove default nginx html
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
|
||||
# copy over our static site from the builder
|
||||
COPY --from=builder /app/site/ /usr/share/nginx/html/
|
||||
|
||||
# (optional) if you have a custom nginx.conf, uncomment:
|
||||
# COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# expose HTTP
|
||||
EXPOSE 80
|
||||
|
||||
# Command to run MkDocs
|
||||
CMD ["mkdocs", "build"]
|
||||
# run nginx in foreground
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue