From feedf052d45c871b947ae3cc29b48821e2c70d77 Mon Sep 17 00:00:00 2001 From: Cosmin Poieana Date: Mon, 2 Dec 2024 18:56:05 +0100 Subject: [PATCH] Optimal way to build docker image with app --- Dockerfile | 8 ++++---- pyproject.toml | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index c274c58..9e3984a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,12 +4,12 @@ WORKDIR /app # Install uv deps with pip. RUN pip install uv COPY pyproject.toml . -RUN uv export --no-dev >requirements.txt && pip install -Ur requirements.txt +RUN uv pip install --system -Ur pyproject.toml -# Copy the rest of the application code. +# Copy the rest of the application code and install the project too. COPY . . +RUN uv pip install --system -e . +# Run the FastAPI app using uvicorn on default port. EXPOSE 80 - -# Command to run the FastAPI app using uvicorn. CMD ["fastapi", "run", "deep_ice", "--port", "80"] diff --git a/pyproject.toml b/pyproject.toml index ccc34da..7b81754 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,9 @@ dev-dependencies = [ "types-passlib>=1.7.7.20240819", ] +[tool.setuptools] +packages = ["deep_ice"] + [tool.pytest.ini_options] # Explicitly set the loop scope for asyncio fixtures to avoid the deprecation warning asyncio_default_fixture_loop_scope = "function"