Skip to content

Commit e39eae5

Browse files
committed
Cache pip packages in CI
* Add mount=type=cache to Dockerfiles * Add actions/cache for pip to CI
1 parent a53343f commit e39eae5

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ jobs:
5151
repository: cmu-delphi/nowcast
5252
path: repos/delphi/nowcast
5353

54+
- name: Cache Python packages
55+
uses: actions/cache@v2
56+
with:
57+
path: ~/.cache/pip # npm cache files are stored in `~/.npm` on Linux/macOS
58+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
59+
restore-keys: |
60+
${{ runner.OS }}-pip-
61+
5462
- name: Build docker images
5563
run: |
5664
docker build -t delphi_database -f repos/delphi/operations/dev/docker/database/Dockerfile .

dev/docker/python/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# start with the `delphi_python` image
22
FROM delphi_python
33

4-
RUN pip install --no-cache-dir -r repos/delphi/delphi-epidata/requirements.txt -r repos/delphi/delphi-epidata/requirements.dev.txt
4+
RUN --mount=type=cache,target=/root/.cache/pip pip install -r repos/delphi/delphi-epidata/requirements.txt -r repos/delphi/delphi-epidata/requirements.dev.txt

devops/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LABEL org.opencontainers.image.source=https://github.com/cmu-delphi/delphi-epida
99
RUN ln -s -f /usr/share/zoneinfo/America/New_York /etc/localtime
1010

1111
COPY requirements.txt /app
12-
RUN pip install --no-cache-dir -r requirements.txt
12+
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt
1313

1414
# disable python stdout buffering
1515
ENV PYTHONUNBUFFERED 1

0 commit comments

Comments
 (0)