-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (34 loc) · 1.37 KB
/
Dockerfile
File metadata and controls
44 lines (34 loc) · 1.37 KB
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
# Almost a copy/paste from: https://github.com/PyO3/pyo3-pack/blob/master/Dockerfile
FROM quay.io/pypa/manylinux2010_x86_64
ENV PATH /root/.cargo/bin:$PATH
# Add all supported python versions
ENV PATH /opt/python/cp36-cp36m/bin/:/opt/python/cp37-cp37m/bin/:/opt/python/cp38-cp38/bin/:/opt/python/cp39-cp39/bin/:$PATH
# Otherwise `cargo new` errors
ENV USER root
RUN curl https://www.musl-libc.org/releases/musl-1.1.20.tar.gz -o musl.tar.gz \
&& tar -xzf musl.tar.gz \
&& rm -f musl.tar.gz \
&& cd musl-1.1.20 \
&& ./configure \
&& make install -j$(expr $(nproc) \+ 1) \
&& cd .. \
&& rm -rf x86_64-unknown-linux-musl \
&& curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none -y \
&& rustup set profile minimal \
&& rustup toolchain install nightly --target x86_64-unknown-linux-musl \
&& rustup default nightly \
&& python3 -m pip install cffi virtualenv \
&& cargo install maturin
WORKDIR /rs_pp
ADD requirements-dev.txt .
RUN virtualenv -p python3 /venv
RUN . /venv/bin/activate && python -m pip install -r requirements-dev.txt
ADD src src
ADD tests tests
ADD Cargo.* ./
ADD pyproject.toml ./
ADD README.md README.md
RUN . /venv/bin/activate && maturin develop && python -m pytest .
ENV RUSTFLAGS="-C target-feature=-crt-static"
RUN maturin build --target x86_64-unknown-linux-musl --manylinux off
CMD ["maturin", "publish"]