Skip to content

Instantly share code, notes, and snippets.

@dignifiedquire
Last active August 8, 2019 10:49
Show Gist options
  • Save dignifiedquire/7602436 to your computer and use it in GitHub Desktop.
Save dignifiedquire/7602436 to your computer and use it in GitHub Desktop.
Dockerfile: Non root nvm setup.
# NVM as non root
#
# VERSION 0.1
FROM ubuntu
MAINTAINER Friedel Ziegelmayer <[email protected]>
# Install dependencies
RUN apt-get update
RUN apt-get install git curl bzip2 -yy
# Setup worker user
RUN useradd -m -p secret worker
RUN chsh -s /bin/bash worker
RUN su - worker -c "touch ~/.bash_profile"
# Install nvm
RUN su - worker -c "curl https://raw.github.com/creationix/nvm/master/install.sh | sh"
RUN su - worker -c "echo '[ -s $HOME/.nvm/nvm.sh ] && . $HOME/.nvm/nvm.sh # This loads NVM' > .profile"
# Install node
RUN su - worker -c "nvm install 0.10"
RUN su - worker -c "nvm alias default 0.10"
# Start the shel as the worker user
#
# Usage: docker run -t -i $IMAGE
CMD su - worker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment