# The app image. It builds on minix-base (.minix/Dockerfile), which minix regenerates with the
# system packages the project needs. Add your own steps here: minix never edits this file. Build
# it with `docker compose build`, which builds minix-base first.
FROM minix-base

# __BEGIN_POETRY_PACKAGES__
# The Python packages, minix included, exactly as poetry.lock pins them.
COPY pyproject.toml poetry.lock ./
RUN pip install --upgrade pip && pip install "poetry>=2,<3" \
    && poetry config virtualenvs.create false \
    && poetry install --only main --no-root --no-interaction

# __END_POETRY_PACKAGES__
# __BEGIN_REQUIREMENTS_PACKAGES__
# The Python packages, minix included, as requirements.txt lists them.
COPY requirements.txt ./
RUN pip install --upgrade pip && pip install -r requirements.txt

# __END_REQUIREMENTS_PACKAGES__
COPY . .

ENV APP_PORT=__APP_PORT__

# Numeric default keeps dockerfile-utils happy; `minix init` rewrites this line.
EXPOSE 8000

CMD ["sh", "-c", "uvicorn entries.api:Api --host 0.0.0.0 --port ${APP_PORT}"]
