Skip to content

Commit

Permalink
fix: Attempt to fix the build cache
Browse files Browse the repository at this point in the history
* `Dockerfile` has been modified to install dependencies in a separate
   layer, in an attempt to make them cacheable - `pydantic-core` is a
   large dependency that takes a long time to build (if wheels aren't
   available, which is the case for ARM platforms)
  • Loading branch information
hostcc committed Sep 9, 2024
1 parent 35b7744 commit 1dfc9e4
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
FROM python:3.13.0rc1-alpine AS build
FROM python:3.12.5-alpine AS build
COPY . /usr/src/
WORKDIR /usr/src/
# Rust and Cargo are required to build `pyndatic-core` on ARM platforms
RUN apk add -U cargo git rust \
&& pip install build \
&& apk cache clean
COPY . /usr/src/
WORKDIR /usr/src/
RUN python -m build
RUN pip install --root target/ dist/*-`cat version.txt`*.whl
# Install dependencies in a separate layer to cache them
RUN pip install -r requirements.txt
# Build the package
RUN python -m build \
&& pip install --root target/ dist/*-`cat version.txt`*.whl

Check notice

Code scanning / SonarCloud

Arguments in long RUN instructions should be sorted Low

Sort these package names alphanumerically. See more on SonarCloud

FROM python:3.13.0rc1-alpine
FROM python:3.12.5-alpine
COPY --from=build \
/usr/src/target/root/.local/lib/ /usr/local/lib/
COPY --from=build \
Expand Down

0 comments on commit 1dfc9e4

Please sign in to comment.