Created
February 23, 2018 06:32
-
-
Save mkamakura/72754ba0c6bec788f3be079361c6f2ae to your computer and use it in GitHub Desktop.
Local Node Environment (using Proxy)
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
FROM ubuntu:latest | |
#### Change to bash | |
RUN mv /bin/sh /bin/sh_tmp && ln -s /bin/bash /bin/sh | |
# Setup proxy | |
ENV http_proxy http://hoge.co.jp:10080 | |
ENV https_proxy http://hoge.co.jp:10080 | |
ENV no_proxy localhost | |
# Install packages | |
RUN apt-get update -y \ | |
&& apt-get upgrade -y \ | |
&& apt-get clean \ | |
&& apt-get install -y \ | |
build-essential \ | |
curl \ | |
git \ | |
libssl-dev \ | |
vim | |
RUN git config --global http.sslVerify false | |
ENV NVM_DIR /usr/local/.nvm | |
# Install nvm | |
RUN git clone https://github.com/creationix/nvm.git $NVM_DIR && \ | |
cd $NVM_DIR && \ | |
git checkout `git describe --abbrev=0 --tags` | |
# Install default version of Node.js | |
RUN source $NVM_DIR/nvm.sh \ | |
&& nvm install node \ | |
&& nvm --version \ | |
&& node --version \ | |
&& npm -g config set proxy http://hoge:10080 \ | |
&& npm -g config set https-proxy http://hoge:10080 \ | |
&& npm -g config set registry http://npm.pt.hoge.co.jp/ | |
# Add nvm.sh to .bashrc for startup... | |
RUN echo "source ${NVM_DIR}/nvm.sh" > $HOME/.bashrc && \ | |
source $HOME/.bashrc | |
#### Change to sh | |
RUN rm /bin/sh && mv /bin/sh_tmp /bin/sh | |
# Commands | |
# - docker build -t test-image . | |
# - docker run -v c:/:/data -it test-image:latest bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment