Skip to content

Add Docker BuildKit to CI and test pip caching #934

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

Draft
wants to merge 2 commits into
base: dev
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
10 changes: 10 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
steps:
- run: mkdir -p repos/undefx
- name: Checkout undefx/py3tester
Expand Down Expand Up @@ -49,6 +51,14 @@ jobs:
repository: cmu-delphi/nowcast
path: repos/delphi/nowcast

- name: Cache Python packages
uses: actions/cache@v2
with:
path: ~/.cache/pip # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.OS }}-pip-

- name: Build docker images
run: |
docker build -t delphi_database -f repos/delphi/operations/dev/docker/database/Dockerfile .
Expand Down
2 changes: 1 addition & 1 deletion dev/docker/python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# start with the `delphi_python` image
FROM delphi_python

RUN pip install --no-cache-dir -r repos/delphi/delphi-epidata/requirements.txt -r repos/delphi/delphi-epidata/requirements.dev.txt
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
2 changes: 1 addition & 1 deletion devops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LABEL org.opencontainers.image.source=https://github.com/cmu-delphi/delphi-epida
RUN ln -s -f /usr/share/zoneinfo/America/New_York /etc/localtime

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

# disable python stdout buffering
ENV PYTHONUNBUFFERED 1
Expand Down