Skip to content

Commit

Permalink
ci: speedup docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Sep 15, 2024
1 parent ff4cb45 commit a021c81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
{
"pip-wheel-cache": "/root/.cache/pip"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}

- name: Build Final Docker Image
uses: docker/build-push-action@v6
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 pip install -r requirements-poetry.txt
RUN --mount=type=cache,target=/root/.cache/pip,sharing=locked pip install -r requirements-poetry.txt

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

### 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 pip install -U pip && \
RUN --mount=type=cache,target=/root/.cache/pip,sharing=locked pip install -U pip && \
pip install -r requirements.txt

WORKDIR /app
Expand Down

0 comments on commit a021c81

Please sign in to comment.