From 8ca5c9dd245ba907f09de04871843238e8977c3c Mon Sep 17 00:00:00 2001 From: "Mitja M. Zdouc" Date: Sat, 28 Feb 2026 20:28:25 +0100 Subject: [PATCH] fixed docker build --- Dockerfile | 38 +++++++++++++++++++------------------- pyproject.toml | 2 +- uv.lock | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index 31688ff..36b914f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,22 +22,6 @@ COPY . /app RUN --mount=type=cache,target=/root/.cache/uv \ uv sync --locked -# Download data to be baked in if no data present -ARG DATA="" -ARG EXTRAS="" -RUN set -eux; \ - if [ -d "data" ]; then \ - echo "Using existing data directory - skip download from Zenodo"; \ - elif [ -n "$DATA" ] && [ -n "$EXTRAS" ]; then \ - echo "Downloading data from Zenodo records $DATA and $EXTRAS"; \ - uv run python scripts/prepare_data.py "$DATA" "$EXTRAS" ; \ - uv run python -m scripts.create_db ; \ - else \ - echo "No data directory found and no $DATA and $EXTRAS provided"; \ - echo " Either populate ./data or pass --build-arg $DATA=..." "$EXTRAS"; \ - exit 1; \ - fi - FROM ubuntu:22.04 ENV DEBIAN_FRONTEND=noninteractive @@ -69,11 +53,27 @@ ENV PATH="/app/.venv/bin:$PATH" # Prevent Python from writing .pyc files ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 -# Use the non-root user to run our application -USER nonroot - # Use `/app` as the working directory WORKDIR /app +# Download data to be baked in if no data present +ARG DATA="" +ARG EXTRAS="" +RUN set -eux; \ + if [ -d "data" ]; then \ + echo "Using existing data directory - skip download from Zenodo"; \ + elif [ -n "$DATA" ] && [ -n "$EXTRAS" ]; then \ + echo "Downloading data from Zenodo records $DATA and $EXTRAS"; \ + python scripts/prepare_data.py "$DATA" "$EXTRAS" ; \ + python -m scripts.create_db ; \ + else \ + echo "No data directory found and no $DATA and $EXTRAS provided"; \ + echo " Either populate ./data or pass --build-arg $DATA=..." "$EXTRAS"; \ + exit 1; \ + fi + +# Use the non-root user to run our application +USER nonroot + # Run the FastAPI application by default CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers", "--forwarded-allow-ips=*"] diff --git a/pyproject.toml b/pyproject.toml index 3533e25..48d28a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mite_web" -version = "2.0.0.beta.13" +version = "2.0.0.beta.14" description = "MITE (Minimum Information about a Tailoring Enzyme) Database Web App" readme = "README.md" requires-python = ">=3.12.0,<3.13.0" # because of rdkit 2024 in mite_extras diff --git a/uv.lock b/uv.lock index 91af6f4..02b7ccf 100644 --- a/uv.lock +++ b/uv.lock @@ -589,7 +589,7 @@ wheels = [ [[package]] name = "mite-web" -version = "2.0.0b13" +version = "2.0.0b14" source = { virtual = "." } dependencies = [ { name = "async-lru" },