-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.wheels
48 lines (36 loc) · 1.7 KB
/
Dockerfile.wheels
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# syntax=docker/dockerfile:1@sha256:fe40cf4e92cd0c467be2cfc30657a680ae2398318afd50b0c80585784c604f28
# base
FROM python:3.12.5@sha256:c7862834f921957523cc4dab6d7795a7a0d19f1cd156c1ecd3a3a08c1108c9a4 as base
RUN apt update && \
apt install dbus python-dbus-dev build-essential libssl-dev libffi-dev python3-dev -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
FROM base AS builder
COPY requirements_mod.txt ./requirements.txt
#COPY ./artifacts/ /wheelartifacts
#ARG TARGETOS
#ARG TARGETVARIANT
#ARG TARGETARCH
#RUN find /wheelartifacts -mindepth 2 -maxdepth 2 -regextype posix-extended -type d -not -regex ".*/${TARGETOS}_${TARGETARCH}(_${TARGETVARIANT})?$" -exec rm -rv {} \; \
# && mv /wheelartifacts/*/*/wheels/* /wheelartifacts || true \
# && du -a /wheelartifacts
# Build dependencys as wheels
#RUN --mount=type=bind,target=/wheelartifacts,source=artifacts,rw \
# find /wheelartifacts -mindepth 2 -maxdepth 2 -regextype posix-extended -type d -not -regex ".*/${TARGETOS}_${TARGETARCH}(_${TARGETVARIANT})?$" -exec rm -rv {} \; \
# && mv /wheelartifacts/*/*/wheels/* /wheelartifacts || true \
# && du -a /wheelartifacts \
ARG PKGS=python3-dev
ARG CRYPTOGRAPHY_DONT_BUILD_RUST=1
RUN apt update && \
apt install $PKGS -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
RUN pip wheel --no-cache --wheel-dir /wheels \
# --find-links file:///wheelartifacts \
-r requirements.txt
FROM scratch AS image-stage
COPY --from=builder /wheels ./wheels
COPY --from=builder requirements.txt ./
# Just a stage to export our wheel
FROM scratch AS export-stage
COPY --from=builder /wheels ./wheels
COPY --from=builder requirements.txt ./