ARG DOCKER_REGISTRY=10.60.129.132:8890
ARG PYTHON_IMAGE=python:3.9.8
FROM ${DOCKER_REGISTRY}/${PYTHON_IMAGE} as base

# Install poetry to manage dependencies
RUN pip install \
      --no-cache-dir \
      --trusted-host 10.60.129.132 \
      --index-url http://10.60.129.132/repository/PyPI/simple \
      --upgrade pip && \
    pip install \
      --no-cache-dir \
      --trusted-host 10.60.129.132 \
      --index-url http://10.60.129.132/repository/PyPI/simple \
      poetry==1.8.5

WORKDIR /

COPY pyproject.toml poetry.lock poetry.toml ./

# Install docs requirements
RUN poetry install --only=docs

ENV PATH="/.venv/bin:${PATH}"
COPY ./mkdocs.yml .
COPY ./docs ./docs
COPY ./backend ./backend

RUN mkdocs build

FROM ${DOCKER_REGISTRY}/nginx:latest

COPY --from=base /site /usr/share/nginx/html/
