Last active
August 8, 2019 10:49
-
-
Save dignifiedquire/7602436 to your computer and use it in GitHub Desktop.
Dockerfile: Non root nvm setup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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