FROM python:3.11-slim AS build

WORKDIR /build

RUN pip install \
    jupyterlab==4.3.6 \
    jupyterlite-core==0.4.5 \
    jupyterlite-pyodide-kernel==0.4.3 \
    jupyterlab-language-pack-pt-BR

COPY jupyter_lite_config.json .
COPY overrides.json overrides.json
COPY content/ ./content/

RUN python -m jupyter lite build \
    --contents ./content \
    --config jupyter_lite_config.json \
    --output-dir _output

RUN mkdir -p _output/settings && \
    cp overrides.json _output/settings/overrides.json && \
    echo '{"status": "UP"}' > _output/health.json

FROM nginx:alpine
COPY --from=build /build/_output /usr/share/nginx/html