Skip to content

Commit

Permalink
remove cache to make docker reuse layer
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Sep 20, 2024
1 parent 64909c9 commit 65d6925
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/release-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,6 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# https://docs.docker.com/build/ci/github-actions/cache/#cache-mounts
- name: Go Build Cache for Docker
uses: actions/cache@v4
with:
path: pip-wheel-cache
key: ${{ runner.os }}-pip-cache-${{ hashFiles('**/poetry.lock') }}
restore-keys:
${{ runner.os }}-pip-cache-

- name: inject pip-wheel-cache into docker
uses: reproducible-containers/[email protected]
with:
cache-map: |
{
"pip-wheel-cache": "/root/.cache/pip"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}

- name: Build Final Docker Image
uses: docker/build-push-action@v6
with:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ WORKDIR /app
ENV PIP_ROOT_USER_ACTION=ignore

COPY requirements-poetry.txt ./
RUN --mount=type=cache,target=/root/.cache/pip,sharing=locked pip install -r requirements-poetry.txt
RUN pip install -r requirements-poetry.txt

COPY pyproject.toml poetry.lock ./
RUN --mount=type=cache,target=/root/.cache/pip,sharing=locked poetry export -f requirements.txt --output requirements.txt
RUN poetry export -f requirements.txt --output requirements.txt

### final image ###
FROM python:3.10-slim@sha256:80619a5316afae7045a3c13371b0ee670f39bac46ea1ed35081d2bf91d6c3dbd
Expand All @@ -24,7 +24,7 @@ COPY --from=poetry /app/requirements.txt ./requirements.txt

ENV PIP_ROOT_USER_ACTION=ignore

RUN --mount=type=cache,target=/root/.cache/pip,sharing=locked pip install -U pip && \
RUN pip install -U pip && \
pip install -r requirements.txt

WORKDIR /app
Expand Down

0 comments on commit 65d6925

Please sign in to comment.