Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

Commit

Permalink
Split out the docker build and final image
Browse files Browse the repository at this point in the history
Try and work around an issue aith gcc in the python armv7 images

docker-library/python#869 (comment)
  • Loading branch information
mdiluz committed Aug 14, 2024
1 parent 5cab5fd commit 0b0494b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
FROM --platform=$TARGETPLATFORM python:3.11-slim
# Split out the wheel build into the non-slim image
# See https://github.com/docker-library/python/issues/869
FROM python:3.12 AS build
COPY requirements.txt ./
RUN --mount=type=cache,target=/var/cache/buildkit/pip \
pip wheel --wheel-dir /wheels -r requirements.txt

FROM python:3.12-slim
LABEL org.opencontainers.image.source=https://github.com/mdiluz/matchy
LABEL org.opencontainers.image.description="Matchy matches matchees"
LABEL org.opencontainers.image.licenses=Unlicense

WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY --from=build /wheels /wheels
RUN --mount=type=cache,target=/var/cache/buildkit/pip \
pip install --find-links /wheels --no-index -r requirements.txt

COPY . .
CMD ["python", "py/matchy.py"]

0 comments on commit 0b0494b

Please sign in to comment.