Add Dockerfile for build system.

This commit is contained in:
Egor Karavaev 2017-06-21 10:30:31 +03:00
parent cc42cab9e2
commit 93c8b92b75
2 changed files with 48 additions and 0 deletions

31
docker/Dockerfile Executable file
View file

@ -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"]

17
docker/entrypoint.sh Executable file
View file

@ -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 "$@"