-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
59 lines (50 loc) · 2.76 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
55
56
57
58
59
FROM ubuntu:xenial
LABEL org.opencontainers.image.title "rust-builder"
LABEL org.opencontainers.image.description "Rust Docker Image based on Ubuntu:Xenial"
LABEL org.opencontainers.image.source https://github.com/bodo-hugo-barwich/rust-builder
LABEL org.opencontainers.image.url ghcr.io/bodo-hugo-barwich/rust-builder
ENV ARCH "x86_64-unknown-linux-gnu"
ENV DOWNLOAD_URL "https://static.rust-lang.org/rustup/dist"
ENV PATH="$PATH:~/.cargo/bin"
ARG RUST_VERSION
RUN apt-get update\
&& echo "path: '${PATH}'"\
&& /usr/bin/apt-get -y install apt-utils apt-file wget
RUN mkdir -p /usr/share/rustup/log\
&& cd /usr/share/rustup/ \
&& date +"%F %T - %s" > log/rustup_install_$(date +"%F").log\
&& echo $(date +"%F %T") "- rustup: downloading ..." | tee -a log/rustup_install_$(date +"%F").log\
&& wget -S ${DOWNLOAD_URL}/${ARCH}/rustup-init.sha256 2>&1 | tee -a log/rustup_install_$(date +"%F").log\
&& wget -S ${DOWNLOAD_URL}/${ARCH}/rustup-init 2>&1 | tee -a log/rustup_install_$(date +"%F").log\
&& echo $(date +"%F %T") "- rustup: download checking ..." | tee -a log/rustup_install_$(date +"%F").log\
&& CHKOK=`sha256sum -c rustup-init.sha256` \
&& echo $CHKOK | tee -a log/rustup_install_$(date +"%F").log \
&& if [ -z "$(echo -n $CHKOK | grep -io 'ok')" ]; then echo $(date +"%F %T") "- rustup: download failed"; false; fi \
&& echo $(date +"%F %T") "- rustup: download OK" | tee -a log/rustup_install_$(date +"%F").log\
&& chmod a+x rustup-init && mv rustup-init /usr/local/bin/ \
&& date +"%F %T - %s" >> log/rustup_install_$(date +"%F").log
#Install additional compiler libraries
RUN apt-get -y install gcc clang clang-8 make pkg-config m4
#Install additional forest dependencies
RUN apt-get -y install libssl-dev ocl-icd-opencl-dev
RUN groupadd rust \
&& useradd rust_builder -g rust -md /home/rust-build
USER rust_builder
RUN mkdir -p /home/rust-build/project/ \
&& mkdir -p /home/rust-build/log \
&& cd /home/rust-build/ \
&& date +"%F %T - %s" > log/rustup-init_install_$(date +"%F").log\
&& echo $(date +"%F %T") "- rustup-init: launching ..." | tee -a log/rustup-init_install_$(date +"%F").log\
&& rustup-init -y --no-modify-path 2>&1 | tee -a log/rustup-init_install_$(date +"%F").log
#&& source ${HOME}/.cargo/env
# Install Rust Version according to Build Argument
RUN if [ -n "$RUST_VERSION" ]; then\
echo "* Requested Rust Compiler Version:" $RUST_VERSION ;\
echo "* Install Rust Compiler requested Version ..." ;\
${HOME}/.cargo/bin/rustup install $RUST_VERSION ;\
${HOME}/.cargo/bin/rustup default $RUST_VERSION ;\
${HOME}/.cargo/bin/rustup toolchain uninstall stable ;\
echo "* Rust Compiler Version:" && ${HOME}/.cargo/bin/rustc --version ;\
echo "* RustUp Show:" && ${HOME}/.cargo/bin/rustup show ;\
fi
WORKDIR /home/rust-build/project/