<commit_before># NodeJS and npm, As the basic environment for development
# ----
# build image:
#   docker build --force-rm -t platbase.com/dev.nodejs:1.0 .
# run:
#   docker run -it --rm -p 8080:8080 -v /tmp/nodejs.ws:/workspace -v /tmp/nodejs.data:/data platbase.com/dev.nodejs:1.0

FROM ubuntu:16.04
MAINTAINER https://github.com/platbase

# The version of node js
ENV VERSION=6.2.0

# The npm registry server
ENV NPM_REG=https://registry.npm.taobao.org

###############################################################################

# Add work user
RUN useradd -mU -u 1000 -d /home/u01 -s /bin/bash u01
RUN echo "u01:docker.io" | chpasswd     # Can't set password properly with "-p" argument in "useradd" command

# Preparing installation
ADD files/* /
RUN \
    apt-get update; \
    export DEBIAN_FRONTEND=noninteractive; \
    apt-get install -y --allow-unauthenticated wget

# Install NodeJS
RUN \
    wget https://nodejs.org/dist/v${VERSION}/node-v${VERSION}-linux-x64.tar.gz -O /tmp/node-v${VERSION}-linux-x64.tar.gz; \
    mkdir -p /opt/nodejs; \
    tar xzvf /tmp/node-v${VERSION}-linux-x64.tar.gz -C /opt/nodejs
RUN chown -Rv u01:u01 /opt/nodejs
RUN export PATH=$PATH:/opt/nodejs/node-v${VERSION}-linux-x64/bin; npm config set prefix /data/global --global
RUN export PATH=$PATH:/opt/nodejs/node-v${VERSION}-linux-x64/bin; npm config set cache  /data/cache  --global
RUN export PATH=$PATH:/opt/nodejs/node-v${VERSION}-linux-x64/bin; npm config set registry ${NPM_REG} --global

# Env setup
ENV PS1_GREEN="\[$(tput bold)$(tput setaf 2)\]"
ENV PS1_RESET="\[$(tput sgr0)\]"
ENV _PS1="${PS1_GREEN}[NodeJS] ${PS1_RESET}\W${PS1_GREEN} > ${PS1_RESET}"
ENV _PATH="./node_modules/.bin:/opt/nodejs/node-v${VERSION}-linux-x64/bin:/opt/nodejs/node-v${VERSION}-linux-x64/bin/npm-global/bin"
RUN echo ""                                >> /home/u01/.bashrc
RUN echo "# Added by docker ******"        >> /home/u01/.bashrc
RUN echo "export PS1=\"${_PS1}\""          >> /home/u01/.bashrc
RUN echo "export PATH=\"\$PATH:${_PATH}\"" >> /home/u01/.bashrc
RUN echo "cd /workspace"                   >> /home/u01/.bashrc

# Clean up
RUN rm /tmp/node-v${VERSION}-linux-x64.tar.gz<commit_msg> 1. Add capability for `sudo`;  2. Install dependancies for node-gyp;  3. Fix: 1)apt-get sources file position bug; 2)bash shell path bug.<commit_after># NodeJS and npm, As the basic environment for development
# ----
# build image:
#   docker build --force-rm -t platbase.com/dev.nodejs:1.0 .
# run:
#   docker run -it --rm -p 8080:8080 -v /tmp/nodejs.ws:/workspace -v /tmp/nodejs.data:/data platbase.com/dev.nodejs:1.0

FROM ubuntu:16.04
MAINTAINER https://github.com/platbase

# The version of node js
ENV VERSION=6.2.0

# The npm registry server
ENV NPM_REG=https://registry.npm.taobao.org

###############################################################################

# Preparing installation
ADD files /
RUN apt-get update
RUN \
    export DEBIAN_FRONTEND=noninteractive; \
    apt-get install -y --allow-unauthenticated sudo; \
    apt-get install -y --allow-unauthenticated wget; \
    apt-get install -y --allow-unauthenticated python; \
    apt-get install -y --allow-unauthenticated build-essential

# Add work user
RUN useradd -mU -u 1000 -d /home/u01 -s /bin/bash u01
RUN echo "u01:docker.io" | chpasswd     # Can't set password properly with "-p" argument in "useradd" command
RUN usermod -a -G sudo u01

# Install NodeJS
RUN \
    wget https://nodejs.org/dist/v${VERSION}/node-v${VERSION}-linux-x64.tar.gz -O /tmp/node-v${VERSION}-linux-x64.tar.gz; \
    mkdir -p /opt/nodejs; \
    tar xzvf /tmp/node-v${VERSION}-linux-x64.tar.gz -C /opt/nodejs
RUN chown -Rv u01:u01 /opt/nodejs
RUN export PATH=$PATH:/opt/nodejs/node-v${VERSION}-linux-x64/bin; npm config set prefix /data/global --global
RUN export PATH=$PATH:/opt/nodejs/node-v${VERSION}-linux-x64/bin; npm config set cache  /data/cache  --global
RUN export PATH=$PATH:/opt/nodejs/node-v${VERSION}-linux-x64/bin; npm config set registry ${NPM_REG} --global

# Env setup
ENV PS1_GREEN="\[$(tput bold)$(tput setaf 2)\]"
ENV PS1_RESET="\[$(tput sgr0)\]"
ENV _PS1="${PS1_GREEN}[NodeJS] ${PS1_RESET}\W${PS1_GREEN} > ${PS1_RESET}"
ENV _PATH="./node_modules/.bin:/data/global/bin"
ENV _PATH="${_PATH}:/opt/nodejs/node-v${VERSION}-linux-x64/bin:/opt/nodejs/node-v${VERSION}-linux-x64/bin/npm-global/bin"
ENV _PATH="/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:${_PATH}"
RUN echo ""                                >> /home/u01/.bashrc
RUN echo "# Added by docker ******"        >> /home/u01/.bashrc
RUN echo "export PS1=\"${_PS1}\""          >> /home/u01/.bashrc
RUN echo "export PATH=\"${_PATH}\""        >> /home/u01/.bashrc
RUN echo "cd /workspace"                   >> /home/u01/.bashrc

# Clean up
RUN rm /tmp/node-v${VERSION}-linux-x64.tar.gz
{'fraction_non_alphanumeric': 0.19908466819221968, 'fraction_numerical': 0.031412523403370085, 'mean_word_length': 3.2624113475177303, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1186443', 'n_tokens_mistral': 1896, 'n_tokens_neox': 1726, 'n_words': 404}