Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
ARG PYTHON=3.13
FROM python:${PYTHON}-alpine AS builder

RUN pip install --no-cache poetry

ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_VIRTUALENVS_OPTIONS_NO_PIP=1 \
POETRY_VIRTUALENVS_OPTIONS_NO_SETUPTOOLS=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

WORKDIR /app

COPY pyproject.toml poetry.lock ./

RUN poetry install --only=main --no-root && \
rm -rf $POETRY_CACHE_DIR
# The operation fails if the readme is missing
RUN --mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
--mount=type=bind,source=README.md,target=README.md \
uv sync --frozen --no-dev --no-editable

FROM python:${PYTHON}-alpine

Expand All @@ -25,6 +20,6 @@ ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH"

COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
COPY src/*.py ./src/
COPY src/tvb/*.py ./src/

CMD ["python", "-m", "src", "--host", "0.0.0.0"]