diff --git a/.github/workflows/database.yml b/.github/workflows/database.yml index 90c53f2..250dbab 100644 --- a/.github/workflows/database.yml +++ b/.github/workflows/database.yml @@ -27,7 +27,7 @@ jobs: run: uv python install 3.10 - name: install python packages - run: uv pip install --system . + run: uv sync - name: track large files run: git lfs track "database/pipeline.pkl" @@ -40,7 +40,7 @@ jobs: ZOTERO_API_KEY: ${{ secrets.ZOTERO_API_KEY }} ZOTERO_LIBRARY_ID: ${{ secrets.ZOTERO_LIBRARY_ID }} HUGGINGFACE_TOKEN: ${{ secrets.HUGGINGFACE_TOKEN }} - run: python run.py + run: uv run python run.py - name: commit files run: | diff --git a/.github/workflows/flyio.yml b/.github/workflows/flyio.yml index 3e6a216..b583460 100644 --- a/.github/workflows/flyio.yml +++ b/.github/workflows/flyio.yml @@ -15,7 +15,7 @@ jobs: name: Deploy app runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: lfs: true - uses: superfly/flyctl-actions/setup-flyctl@master diff --git a/Dockerfile b/Dockerfile index b4d8c25..d80e5f3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,20 +3,20 @@ FROM python:3.10-slim # Install uv COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ -# Clone the repository WORKDIR /code # Copy the necessary files -COPY database/pipeline.pkl /code/database/pipeline.pkl COPY pyproject.toml /code/pyproject.toml +COPY readme.md /code/readme.md +COPY database/pipeline.pkl /code/database/pipeline.pkl COPY knowledge_database /code/knowledge_database COPY api /code/api -# Install Python dependencies using uv -RUN uv pip install --system . +# Install Python dependencies using uv with a virtual environment +RUN uv venv /code/.venv && uv pip install --python /code/.venv/bin/python . # Set up the secret environment variable for OpenAI API Key RUN --mount=type=secret,id=OPENAI_API_KEY sh -c 'echo "export OPENAI_API_KEY=$(cat /run/secrets/OPENAI_API_KEY)" >> /etc/profile.d/openai.sh' # Set the command to run the application -CMD ["/bin/bash", "-c", "source /etc/profile && uvicorn api.api:app --host 0.0.0.0 --port 8080"] +CMD ["/bin/bash", "-c", "source /etc/profile && /code/.venv/bin/uvicorn api.api:app --host 0.0.0.0 --port 8080"]