Skip to content

Commit

Permalink
Cache Unchanged Layers (#50)
Browse files Browse the repository at this point in the history
* Fixup default branch

* Prevent build version from invalidating cached pip installs

* Reuse unchanged image layers when building on CI
  • Loading branch information
ivan-c authored Nov 20, 2023
1 parent 3f64ed5 commit 423e6e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build-deliver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- name: Publish to GitHub Container Registry
# TODO: pin to hash
uses: elgohr/Publish-Docker-Github-Action@master
uses: elgohr/Publish-Docker-Github-Action@main
with:
name: ${{ github.repository }}
registry: ghcr.io
Expand All @@ -33,3 +33,5 @@ jobs:
# create docker image tags to match git tags
tag_names: true
buildargs: VERSION_STRING
# cache layers that have not changed between builds (eg dependencies)
cache: true
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ FROM python:3.7

WORKDIR /opt/app

ARG VERSION_STRING
ENV VERSION_STRING=$VERSION_STRING

COPY requirements.txt .
RUN pip install --requirement requirements.txt

COPY . .

ARG VERSION_STRING
ENV VERSION_STRING=$VERSION_STRING

ENV FLASK_APP=isacc_messaging.app:create_app() \
PORT=8000

Expand Down

0 comments on commit 423e6e0

Please sign in to comment.