Dockerfile
This file
Path
Dockerfile
112 lines · 3.6 KiB · Dockerfile
Last changed by
[readme] Fix a Docker warning from using Docker installation instructionsclifennelbefore adoption6dc3765
History of this fileTake it
The walk stopped after 200 commits: lines older than 5c12680 point at it.
[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680
lines 1–17why, one step back1# Dockerized nvm development environment2#3# This Dockerfile is for building nvm development environment only,4# not for any distribution/production usage.5#6# Please note that it'll use about 1.2 GB disk space and about 15 minutes to7# build this image, it depends on your hardware.89FROM ubuntu:22.0410LABEL maintainer="Peter Dave Hello <hsu@peterdavehello.org>"11LABEL name="nvm-dev-env"12LABEL version="latest"1314# Set the SHELL to bash with pipefail option15SHELL ["/bin/bash", "-o", "pipefail", "-c"]1617# Prevent dialog during apt install[readme] Fix a Docker warning from using Docker installation instructionsclifennelbefore adoption6dc3765
line 18why, one step back18ENV DEBIAN_FRONTEND=noninteractive[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680
lines 19–24why, one step back1920# ShellCheck version21ENV SHELLCHECK_VERSION=0.7.02223# Pick a Ubuntu apt mirror site for better speed24# ref: https://launchpad.net/ubuntu/+archivemirrors[readme] Fix a Docker warning from using Docker installation instructionsclifennelbefore adoption6dc3765
line 25why, one step back25ENV UBUNTU_APT_SITE=ubuntu.cs.utah.edu[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680
lines 26–94why, one step back2627# Replace origin apt package site with the mirror site28RUN sed -E -i "s/([a-z]+.)?archive.ubuntu.com/$UBUNTU_APT_SITE/g" /etc/apt/sources.list29RUN sed -i "s/security.ubuntu.com/$UBUNTU_APT_SITE/g" /etc/apt/sources.list3031# Install apt packages32RUN apt update && \33 apt upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" && \34 apt install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \35 coreutils \36 util-linux \37 bsdutils \38 file \39 openssl \40 libssl-dev \41 locales \42 ca-certificates \43 ssh \44 wget \45 patch \46 sudo \47 htop \48 dstat \49 vim \50 tmux \51 curl \52 git \53 jq \54 zsh \55 ksh \56 gcc \57 g++ \58 xz-utils \59 build-essential \60 bash-completion && \61 apt-get clean6263RUN wget https://github.com/koalaman/shellcheck/releases/download/v$SHELLCHECK_VERSION/shellcheck-v$SHELLCHECK_VERSION.linux.x86_64.tar.xz -O- | \64 tar xJvf - shellcheck-v$SHELLCHECK_VERSION/shellcheck && \65 mv shellcheck-v$SHELLCHECK_VERSION/shellcheck /bin && \66 rmdir shellcheck-v$SHELLCHECK_VERSION67RUN shellcheck -V6869# Set locale70RUN locale-gen en_US.UTF-87172# Print tool versions73RUN bash --version | head -n 174RUN zsh --version75RUN ksh --version || true76RUN dpkg -s dash | grep ^Version | awk '{print $2}'77RUN git --version78RUN curl --version79RUN wget --version8081# Add user "nvm" as non-root user82RUN useradd -ms /bin/bash nvm8384# Copy and set permission for nvm directory85COPY . /home/nvm/.nvm/86RUN chown nvm:nvm -R "/home/nvm/.nvm"8788# Set sudoer for "nvm"89RUN echo 'nvm ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers9091# Switch to user "nvm" from now92USER nvm9394# Create a script file sourced by both interactive and non-interactive bash shells[readme] Fix a Docker warning from using Docker installation instructionsclifennelbefore adoption6dc3765
line 95why, one step back95ENV BASH_ENV=/home/nvm/.bash_env[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680
lines 96–112why, one step back96RUN touch "$BASH_ENV"97RUN echo '. "$BASH_ENV"' >> "$HOME/.bashrc"9899# nvm100RUN echo 'export NVM_DIR="$HOME/.nvm"' >> "$BASH_ENV"101RUN echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> "$BASH_ENV"102RUN echo '[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion' >> "$BASH_ENV"103104# nodejs and tools105RUN nvm install node106RUN npm install -g doctoc urchin eclint dockerfile_lint107RUN npm install --prefix "$HOME/.nvm/"108109# Set WORKDIR to nvm directory110WORKDIR /home/nvm/.nvm111112ENTRYPOINT ["/bin/bash"]