Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache pip #423

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions .github/workflows/aws-ecs-deploy-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions requirements/_core.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ ua-parser
ujson
neo4j
neomodel==5.3.3
pyzmq==26.2.1
9 changes: 4 additions & 5 deletions requirements/dev_unix.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading