From 76af8c2a8e71bab5b2ce799e4968f749b88270df Mon Sep 17 00:00:00 2001 From: Mike Yavorsky Date: Wed, 29 Jan 2025 17:12:29 -0500 Subject: [PATCH 1/2] add pip cache, pass to docker --- .github/workflows/aws-ecs-deploy-backend.yml | 12 ++++++++++++ .github/workflows/python-tests.yml | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/aws-ecs-deploy-backend.yml b/.github/workflows/aws-ecs-deploy-backend.yml index 149f5641..9cbd865a 100644 --- a/.github/workflows/aws-ecs-deploy-backend.yml +++ b/.github/workflows/aws-ecs-deploy-backend.yml @@ -57,6 +57,17 @@ jobs: runs-on: ubuntu-latest needs: [setup_env] steps: + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + cache: 'pip' + cache-dependency-path: | + **/requirements*.txt + - name: Identify pip cache directory + id: vars + run: | + echo "pip-dir=$(pip3 cache dir)" >> $GITHUB_OUTPUT - name: Checkout uses: actions/checkout@v4 with: @@ -79,6 +90,7 @@ jobs: uses: docker/build-push-action@v6 with: context: ${{ env.DOCKER_PATH }} + build-contexts: pip_cache=${{steps.vars.outputs.pip-dir}} file: ${{ env.DOCKERFILE }} platforms: ${{ env.PLATFORMS }} push: true diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index e9aa43c3..63f8c120 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -24,7 +24,10 @@ jobs: - name: Python 3.13 Setup uses: actions/setup-python@v5 with: - python-version: 3.13 + python-version: '3.13' + cache: 'pip' + cache-dependency-path: | + **/requirements*.txt - name: Install dependencies run: | sudo apt-get update From 6c518ec08285fd03619bccde19780bf8124e1e99 Mon Sep 17 00:00:00 2001 From: Mike Yavorsky Date: Tue, 4 Feb 2025 20:25:10 -0500 Subject: [PATCH 2/2] don't use build context, update pyzmq requirement --- backend/Dockerfile | 4 ++-- requirements/_core.in | 1 + requirements/dev_unix.txt | 9 ++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index b2400dc2..811f9179 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -23,11 +23,11 @@ WORKDIR /app/ ARG NPDI_API_PORT=5000 -RUN pip3 install --upgrade pip +RUN --mount=type=cache,target=/root/.cache/pip,from=pip_cache pip3 install --upgrade pip COPY requirements/ requirements/ -RUN pip3 install -r requirements/dev_unix.txt +RUN --mount=type=cache,target=/root/.cache/pip,from=pip_cache pip3 install -r requirements/dev_unix.txt COPY . . ENV PORT=$NPDI_API_PORT diff --git a/requirements/_core.in b/requirements/_core.in index d0bb7ffc..bbc33d67 100644 --- a/requirements/_core.in +++ b/requirements/_core.in @@ -34,3 +34,4 @@ ua-parser ujson neo4j neomodel==5.3.3 +pyzmq==26.2.1 \ No newline at end of file diff --git a/requirements/dev_unix.txt b/requirements/dev_unix.txt index 97f94df7..79251974 100644 --- a/requirements/dev_unix.txt +++ b/requirements/dev_unix.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.12 +# This file is autogenerated by pip-compile with Python 3.13 # by the following command: # # pip-compile requirements/dev_unix.in @@ -58,9 +58,7 @@ certifi==2024.2.2 # httpx # requests cffi==1.16.0 - # via - # argon2-cffi-bindings - # bcrypt + # via argon2-cffi-bindings charset-normalizer==3.3.2 # via requests click==8.1.7 @@ -379,8 +377,9 @@ pyyaml==6.0.1 # via # -r requirements/_core.in # jupyter-events -pyzmq==25.1.2 +pyzmq==26.2.1 # via + # -r requirements/_core.in # ipykernel # jupyter-client # jupyter-console