From 434ee87ad73078a8c167f47a9618be7529c2cae8 Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Wed, 3 Aug 2016 15:38:43 -0700 Subject: [PATCH] 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 :) --- Dockerfile | 9 +++++++-- build-rubies.sh | 2 +- sudoers | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 sudoers diff --git a/Dockerfile b/Dockerfile index 47c1eea..68cb551 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/build-rubies.sh b/build-rubies.sh index a882bbb..1884021 100755 --- a/build-rubies.sh +++ b/build-rubies.sh @@ -11,7 +11,7 @@ for RUBY in "${RUBIES[@]}"; do cat > $DOCKERFILE < Making ${IMAGE_TAG}:${RUBY}" diff --git a/sudoers b/sudoers new file mode 100644 index 0000000..c48a2fb --- /dev/null +++ b/sudoers @@ -0,0 +1 @@ +%sudo ALL=(ALL) NOPASSWD: ALL