Create an `rvm` user instead of relying on root for the container.

The `rvm` user has passwordless sudo in the container, so that shouldn't slow
anybody down :)
This commit is contained in:
R. Tyler Croy 2016-08-03 15:38:43 -07:00
parent d4f1d9a517
commit 434ee87ad7
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
3 changed files with 9 additions and 3 deletions

View File

@ -3,7 +3,12 @@ FROM ubuntu:trusty
# Grab the bare necessities for installing RVM and some Rubies
RUN apt-get update && \
apt-get install -yq git build-essential curl gnupg && \
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 && \
useradd -c "RVM User" -d /home/rvm -G sudo -s /bin/bash -m rvm
USER rvm
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 && \
curl -sSL https://get.rvm.io | bash -s stable
COPY rvmrc /root/.rvmrc
COPY sudoers /etc/sudoers.d/10-sudo-nopasswd
COPY rvmrc /home/rvm/.rvmrc

View File

@ -11,7 +11,7 @@ for RUBY in "${RUBIES[@]}"; do
cat > $DOCKERFILE <<EOF
FROM ${IMAGE_TAG}:latest
RUN bash -c 'source /usr/local/rvm/scripts/rvm && rvm install ${RUBY}'
RUN bash -c 'source ~/.rvm/scripts/rvm && rvm install ${RUBY}'
EOF
echo "> Making ${IMAGE_TAG}:${RUBY}"

1
sudoers Normal file
View File

@ -0,0 +1 @@
%sudo ALL=(ALL) NOPASSWD: ALL