-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
54 lines (47 loc) · 2.08 KB
/
Dockerfile
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
49
50
51
52
53
54
FROM fedora:27
########## SYSTEM SETUP ##########
RUN dnf -y update; dnf clean all
# fundamental packages
RUN dnf -y install file gcc make man sudo tar; dnf clean all
# Download Rustup installer
RUN curl https://sh.rustup.rs -o /usr/bin/rustup-install
RUN chmod +x /usr/bin/rustup-install
########## RUST ##########
RUN useradd -ms /bin/bash rustacean
USER rustacean
# Install Rustup
RUN rustup-install -y
# Install Rust
RUN /home/rustacean/.cargo/bin/rustup update
RUN /home/rustacean/.cargo/bin/rustup target add x86_64-pc-windows-gnu
# Install target config
ADD cargo.config /home/rustacean/.cargo/config
########## MINGW & BUILD DEPENDENCIES ##########
USER root
RUN dnf -y install mingw64-gcc
RUN dnf -y install mingw64-freetype freetype freetype-devel
RUN dnf -y install mingw64-cairo mingw64-cairo-static cairo cairo-devel
RUN dnf -y install mingw64-harfbuzz harfbuzz harfbuzz-devel
RUN dnf -y install mingw64-pango pango pango-devel
RUN dnf -y install mingw64-poppler poppler poppler-devel
RUN dnf -y install mingw64-gtk3 gtk3 gtk3-devel
RUN dnf -y install mingw64-glib2-static glib2 glib2-devel
RUN dnf -y install atk atk-devel
RUN dnf -y install mingw64-winpthreads mingw64-winpthreads-static
########## CONFIG ##########
USER rustacean
ENV PKG_CONFIG_ALLOW_CROSS=1
ENV PKG_CONFIG_PATH=/usr/i686-w64-mingw32/lib/pkgconfig
# Mount your project here and docker start
VOLUME /home/rustacean/src
WORKDIR /home/rustacean/src
CMD ["/home/rustacean/.cargo/bin/cargo", "build", "--target=x86_64-pc-windows-gnu", "--release"]
# 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):
# $ docker create -v `pwd`:/home/rustacean/src --name PROJECTNAME-build PROJECTNAME-build-image
# 4) Each time you want to build the project, start the Docker container.
# Add "-ai" to watch the build progress.
# $ docker start PROJECTNAME-build