Skip to content

Commit d39d43d

Browse files
committed
build: cache installed packages
1 parent c250048 commit d39d43d

File tree

5 files changed

+314
-334
lines changed

5 files changed

+314
-334
lines changed

.github/workflows/deploy-image.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ jobs:
3131
push: true
3232
tags: ${{ steps.meta.outputs.tags }}
3333
labels: ${{ steps.meta.outputs.labels }}
34+
cache-from: type=gha
35+
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ ENV PATH=.venv/bin:${PATH}
66
FROM base AS build
77
ENV PDM_CHECK_UPDATE=false
88

9-
RUN pip install pdm
10-
COPY pyproject.toml pdm.lock ./
11-
RUN pdm sync --prod --no-editable
9+
RUN --mount=type=cache,target=/root/.cache/pip \
10+
pip install pdm
11+
RUN --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
12+
--mount=type=bind,source=pdm.lock,target=pdm.lock \
13+
--mount=type=cache,target=/root/.cache/pdm \
14+
pdm sync --prod --no-editable
1215

1316

1417
FROM base
1518

16-
COPY --from=build /app/.venv/ .venv
17-
COPY . .
19+
COPY --link --from=build /app/.venv/ .venv
20+
COPY --link . .
1821

1922
CMD nb orm upgrade && nb run

0 commit comments

Comments
 (0)