FROM python:3.15.0a7-alpine3.22
ENV PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
# Install build tools needed to compile wheels
RUN apk add --no-cache build-base
# Install Python build-time dependencies for MkDocs
RUN pip install --upgrade pip
RUN pip install mkdocs-material==9.5.5 mkdocs-glightbox
WORKDIR /hello-algo
# Prepare build directories that MkDocs expects
RUN mkdir -p build/docs build/overrides
# Copy core docs sources
COPY docs ./build/docs
# Optional overrides directory (empty if not provided in repo)
RUN mkdir -p build/overrides
# MkDocs configuration and building of the main site
COPY mkdocs.yml mkdocs.yml
RUN mkdocs build -f mkdocs.yml
# Build Chinese (zh-hant) docs as part of the multi-language site
COPY zh-hant/docs ./build/zh-hant/docs
COPY zh-hant/mkdocs.yml zh-hant/mkdocs.yml
RUN mkdocs build -f zh-hant/mkdocs.yml
# Build English docs
COPY en/docs ./build/en/docs
COPY en/mkdocs.yml en/mkdocs.yml
RUN mkdocs build -f en/mkdocs.yml
WORKDIR /hello-algo/site
EXPOSE 8000
CMD ["python", "-m", "http.server", "8000"]