File tree Expand file tree Collapse file tree 1 file changed +16
-16
lines changed Expand file tree Collapse file tree 1 file changed +16
-16
lines changed Original file line number Diff line number Diff line change 1- # Get a python 3.10 image
2- FROM python:3.10.9
3- LABEL org.opencontainers.image.source=https://github.com/gbdev/pandocs
4- SHELL ["bash" , "-lc" ]
5- RUN apt update
6- RUN apt install curl -y
7-
8- # Install rust and mdbook
9- RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
10- RUN apt install gcc -y
11- RUN source "$HOME/.cargo/env"
1+ # --- Stage 1: build mdBook binary ---
2+ FROM rust:1.83 AS builder
123RUN cargo install mdbook
134
14- COPY . /code
5+ # --- Stage 2: final Python runtime ---
6+ FROM python:3.10-slim
7+
8+ # Copy mdBook binary only (no Rust toolchain)
9+ COPY --from=builder /usr/local/cargo/bin/mdbook /usr/local/bin/mdbook
10+
11+ # Install dependencies
12+ RUN apt-get update && apt-get install -y curl gcc && rm -rf /var/lib/apt/lists/*
13+
14+ # Set up working directory
1515WORKDIR /code
16+ COPY . /code
1617
17- # Init python3 env
18+ # Python environment
1819RUN python -m venv env
19- RUN source env/bin/activate
20- RUN pip install -r requirements.txt
20+ RUN . env/bin/activate && pip install --no-cache-dir -r requirements.txt
2121
22- # Serve pandocs at localhost:8000
22+ # Build and serve docs
2323RUN mdbook build
2424CMD mdbook watch & (cd /code/docs/pandocs/ && python3 -m http.server)
You can’t perform that action at this time.
0 commit comments