1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
# Based on https://softwarejourneyman.com/docker-python-install-wheels.html
#########################################
# Image WITH C compiler, building wheels for next stage
FROM python:3.12-alpine as bigimage
ENV LANG C.UTF-8
# Copy project files
COPY . /src/xbox-webapi
# install the C compiler
RUN apk add --no-cache jq gcc musl-dev libffi-dev openssl-dev cargo
# instead of installing, create a wheel
RUN pip wheel --wheel-dir=/root/wheels /src/xbox-webapi
#########################################
# Image WITHOUT C compiler, installing the component from wheel
FROM python:3.12-alpine as smallimage
RUN apk add --no-cache openssl
COPY --from=bigimage /root/wheels /root/wheels
# Ignore the Python package index
# and look for archives in
# /root/wheels directory
RUN pip install \
--no-index \
--find-links=/root/wheels \
xbox-webapi
|