44 lines
1.9 KiB
Docker
Raw Normal View History

2019-10-29 10:13:48 -07:00
FROM ubuntu:16.04
2019-10-14 21:50:46 -07:00
LABEL Description="Rust compile env for Linux + Windows (cross)"
RUN apt update
2019-10-29 10:13:48 -07:00
RUN apt install -y build-essential mingw-w64 gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf curl vim wget
# Get Rust
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
2019-10-14 21:50:46 -07:00
RUN rustup target add x86_64-pc-windows-gnu
RUN rustup target add aarch64-unknown-linux-gnu
RUN rustup target add armv7-unknown-linux-gnueabihf
# Append the linker to the cargo config for Windows cross compile
2019-10-29 10:13:48 -07:00
RUN echo "[target.x86_64-pc-windows-gnu]" >> /root/.cargo/config && \
echo "linker = '/usr/bin/x86_64-w64-mingw32-gcc'" >> /root/.cargo/config
2019-10-14 21:50:46 -07:00
2019-10-29 10:13:48 -07:00
RUN echo "[target.aarch64-unknown-linux-gnu]" >> /root/.cargo/config && \
echo "linker = '/usr/bin/aarch64-linux-gnu-gcc'" >> /root/.cargo/config
2019-10-14 21:50:46 -07:00
2019-10-29 10:13:48 -07:00
RUN echo "[target.armv7-unknown-linux-gnueabihf]" >> /root/.cargo/config && \
echo "linker = '/usr/bin/arm-linux-gnueabihf-gcc'" >> /root/.cargo/config
2019-10-14 21:50:46 -07:00
ENV CC_x86_64_unknown_linux_musl="gcc"
ENV CC_aarch64_unknown_linux_gnu="aarch64-linux-gnu-gcc"
2019-10-14 22:12:40 -07:00
ENV CC_armv7_unknown_linux_gnueabhihf="arm-linux-gnueabihf-gcc"
2019-10-14 21:50:46 -07:00
2019-10-14 22:12:40 -07:00
# This is a bug fix for the windows cross compiler for Rust.
2019-10-29 10:13:48 -07:00
RUN cp /usr/x86_64-w64-mingw32/lib/crt2.o /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/crt2.o
2019-10-14 21:50:46 -07:00
2019-10-21 10:50:11 -07:00
# For windows cross compilation, use a pre-build binary. Remember to set the
# SODIUM_LIB_DIR for windows cross compilation
2019-10-21 10:41:29 -07:00
RUN cd /opt && wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.17-mingw.tar.gz && \
2019-10-22 07:42:43 -07:00
tar xvf libsodium-1.0.17-mingw.tar.gz
2019-10-29 10:13:48 -07:00
RUN apt install -y git
2019-10-22 07:42:43 -07:00
# Cargo fetch the dependencies so we don't download them over and over again
2021-03-03 21:12:13 -08:00
RUN cd /tmp && git clone https://github.com/piratenetwork/piratewallet-light-cli.git && \
cd piratewallet-light-cli && \
2019-10-22 07:42:43 -07:00
cargo fetch && \
2021-03-03 21:12:13 -08:00
cd /tmp && rm -rf piratewallet-light-cli