-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.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:865e5dd094beca432e8c0a1d5e1c465db5f998dca4e439981029b3b81fb39ed5
# base
FROM python:3.12.5@sha256:11aa4b620c15f855f66f02a7f3c1cd9cf843cc10f3edbcf158e5ebcd98d1f549 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 ./