From 93c8b92b758d84f6c77dd2bac8bece5dbbedfff0 Mon Sep 17 00:00:00 2001 From: Egor Karavaev Date: Wed, 21 Jun 2017 10:30:31 +0300 Subject: [PATCH] Add Dockerfile for build system. --- docker/Dockerfile | 31 +++++++++++++++++++++++++++++++ docker/entrypoint.sh | 17 +++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100755 docker/Dockerfile create mode 100755 docker/entrypoint.sh diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100755 index 0000000..5717fee --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,31 @@ +FROM ubuntu:17.04 + +ENV REDOX_TOOLCHAIN_APT http://static.redox-os.org/toolchain/apt/ +ENV SRC_PATH /src +ENV CARGO_HOME /cargo +ENV RUSTUP_HOME /rustup +ENV PATH $CARGO_HOME/bin:$PATH + +RUN apt-get update \ + && apt-get install -y git gosu gcc fuse nasm qemu-utils pkg-config \ + libfuse-dev make curl file sudo apt-transport-https \ + && mkdir -p $CARGO_HOME \ + && mkdir -p $RUSTUP_HOME \ + && curl https://sh.rustup.rs > sh.rustup.rs \ + && sh sh.rustup.rs -y \ + && rustup update \ + && rustup component add rust-src \ + && rustup default nightly \ + && echo "deb $REDOX_TOOLCHAIN_APT /" >> /etc/apt/sources.list.d/redox.list \ + && apt-get update \ + && apt-get install -y --force-yes x86-64-elf-redox-newlib x86-64-elf-redox-binutils x86-64-elf-redox-gcc \ + && cargo install xargo \ + && mkdir -p "$SRC_PATH" + +WORKDIR $SRC_PATH + +COPY entrypoint.sh /usr/local/bin/entrypoint.sh + +RUN chmod +x /usr/local/bin/entrypoint.sh + +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000..2270106 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Add local user +# Either use the LOCAL_USER_ID if passed in at runtime or +# fallback + +USER_ID=${LOCAL_USER_ID:-9001} + +echo "Starting with UID : $USER_ID " +echo "CARGO_HOME is $CARGO_HOME" +echo "RUSTUP_HOME is $RUSTUP_HOME" +useradd --shell /bin/bash -u $USER_ID -o -c "" -m user +export HOME=/home/user +chown user:user -R $CARGO_HOME +chown user:user -R $RUSTUP_HOME + +exec gosu user:user "$@"