summary refs log tree commit diff
path: root/docker/Dockerfile-cargo-cache
blob: b4673fff53aa08d6a79b6388e95ed5ee3257ed39 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# A docker file that caches the cargo index for the cryptography deps. This is
# mainly useful for multi-arch builds where fetching the index from the internet
# fails for 32bit archs built on 64 bit platforms.

ARG PYTHON_VERSION=3.8

FROM --platform=$BUILDPLATFORM docker.io/python:${PYTHON_VERSION}-slim as builder

RUN apt-get update && apt-get install -y \
    rustc \
    && rm -rf /var/lib/apt/lists/*

RUN pip download --no-binary cryptography --no-deps cryptography

RUN tar -xf cryptography*.tar.gz --wildcards cryptography*/src/rust/

RUN cd cryptography*/src/rust && cargo fetch

FROM docker.io/python:${PYTHON_VERSION}-slim

COPY --from=builder /root/.cargo /root/.cargo