docker-rust-cross/Dockerfile

38 lines
1.4 KiB
Docker
Raw Permalink Normal View History

2018-01-10 03:43:20 +00:00
FROM fedora:latest
RUN useradd -ms /bin/bash rust
# pre-compiled from https://github.com/gsauthof/pe-util
ADD peldd /usr/bin/peldd
ADD package.sh /usr/bin/package.sh
2020-10-04 14:58:06 +00:00
RUN dnf install -y mingw64-gcc mingw64-freetype mingw64-cairo mingw64-harfbuzz mingw64-pango mingw64-poppler mingw64-gtk3 mingw64-winpthreads-static mingw64-glib2-static gcc boost zip git cmake @development-tools && dnf clean all -y
2018-01-10 03:43:20 +00:00
USER rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
RUN . ~/.cargo/env && \
rustup install nightly && \
rustup default nightly && \
rustup target add x86_64-pc-windows-gnu
ADD cargo.config /home/rust/.cargo/config
ENV PKG_CONFIG_ALLOW_CROSS=1
ENV PKG_CONFIG_PATH=/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig/
ENV GTK_INSTALL_PATH=/usr/x86_64-w64-mingw32/sys-root/mingw/
VOLUME /home/rust/src
WORKDIR /home/rust/src
CMD ["/usr/bin/package.sh"]
# So one could build a project in the current directory, where this Dockerfile is by
# 1) Modifying the Dockerfile to add all your native dependencies
# 2) Building the image:
# $ docker build . -t PROJECTNAME-build-image
# 3) Creating a container with the source mounted the image (which kicks off the build):
2020-10-03 01:30:15 +00:00
# $ docker create -v `pwd`:/home/rust/src --name PROJECTNAME-build PROJECTNAME-build-image
2020-10-04 09:29:31 +00:00
# 4) Each time you want to build the project, start the Docker container.
2018-01-10 03:43:20 +00:00
# Add "-ai" to watch the build progress.
# $ docker start PROJECTNAME-build