diff --git a/Dockerfile b/Dockerfile index 3fe7d4ac..0329c3fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,64 @@ -FROM wombatant/devenv:latest +FROM fedora:27 ENV DEVKITPRO /opt/devkitPro ENV DEVKITARM ${DEVKITPRO}/devkitARM -RUN dnf install -y findutils ninja-build +RUN dnf update -y +############################################################################### +# Install gosu + +RUN dnf install -y curl gnupg +RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 +RUN curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.10/gosu-amd64" && \ + curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.10/gosu-amd64.asc" && \ + gpg --verify /usr/local/bin/gosu.asc && \ + rm /usr/local/bin/gosu.asc && \ + chmod +x /usr/local/bin/gosu + +############################################################################### +# Install dev tools + +RUN dnf install -y clang +RUN dnf install -y llvm +RUN dnf install -y libasan +RUN dnf install -y mingw64-gcc-c++ +RUN dnf install -y cmake +RUN dnf install -y make +RUN dnf install -y git +RUN dnf install -y vim +RUN dnf install -y sudo +RUN dnf install -y fuse-devel +RUN dnf install -y qt5-devel +RUN dnf install -y findutils +RUN dnf install -y ninja-build + +############################################################################### +# Install devkitARM + +RUN dnf install -y lbzip2 +RUN curl -o /tmp/devkitArm.tar.bz2 -SL https://phoenixnap.dl.sourceforge.net/project/devkitpro/devkitARM/devkitARM_r47/devkitARM_r47-x86_64-linux.tar.bz2 +WORKDIR /opt +RUN tar xf /tmp/devkitArm.tar.bz2 + +############################################################################### +# Setup sudoers + +ADD devenv/sudoers /etc/sudoers + +############################################################################### +# Setup working directory + +RUN mkdir /usr/src/project +WORKDIR /usr/src/project + +############################################################################### +# Setup entrypoint + +ADD devenv/entrypoint.sh / +ENTRYPOINT ["/entrypoint.sh"] + +############################################################################### # Install Powershell RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc RUN curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo diff --git a/devenv/entrypoint.sh b/devenv/entrypoint.sh new file mode 100755 index 00000000..dd85848d --- /dev/null +++ b/devenv/entrypoint.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# script from Deni Bertovic +# https://denibertovic.com/posts/handling-permissions-with-docker-volumes/ + +# Add local user +# Either use the LOCAL_USER_ID if passed in at runtime or +# fallback + +USER_ID=${LOCAL_USER_ID:-9001} + +if [[ $(id -u user 2> /dev/null) != $USER_ID ]]; then + useradd --shell /bin/bash -u $USER_ID -o -c "" -m user + export HOME=/home/user + echo "set -o vi" >> $HOME/.bashrc + echo "export PATH=\${PATH}:/opt/devkitPro/devkitARM/bin/" >> $HOME/.bashrc + echo "export DEVKITPRO=/opt/devkitPro" >> $HOME/.bashrc + echo "export DEVKITARM=/opt/devkitPro/devkitARM" >> $HOME/.bashrc + echo "export CC=/usr/bin/clang" >> $HOME/.bashrc + echo "export CXX=/usr/bin/clang++" >> $HOME/.bashrc +fi + +exec /usr/local/bin/gosu user "$@" diff --git a/devenv/sudoers b/devenv/sudoers new file mode 100644 index 00000000..3b1ef0d5 --- /dev/null +++ b/devenv/sudoers @@ -0,0 +1,9 @@ +## +## User privilege specification +## +root ALL=(ALL) ALL +%wheel ALL=(ALL) ALL +user ALL=NOPASSWD: ALL + +# Long timeout +Defaults env_reset,timestamp_timeout=9999999999