mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-06-27 11:38:43 +00:00
Fixed inconsistent env's in Dockerfile & reduced layers
This commit is contained in:
parent
eed0d0e85c
commit
6915d4460d
42
Dockerfile
42
Dockerfile
@ -68,26 +68,26 @@ RUN wget https://github.com/koalaman/shellcheck/releases/download/v$SHELLCHECK_V
|
|||||||
tar xJvf - shellcheck-v$SHELLCHECK_VERSION/shellcheck && \
|
tar xJvf - shellcheck-v$SHELLCHECK_VERSION/shellcheck && \
|
||||||
mv shellcheck-v$SHELLCHECK_VERSION/shellcheck /bin && \
|
mv shellcheck-v$SHELLCHECK_VERSION/shellcheck /bin && \
|
||||||
rmdir shellcheck-v$SHELLCHECK_VERSION
|
rmdir shellcheck-v$SHELLCHECK_VERSION
|
||||||
RUN shellcheck -V
|
|
||||||
|
|
||||||
# Set locale
|
|
||||||
RUN locale-gen en_US.UTF-8
|
|
||||||
|
|
||||||
# Print tool versions
|
# Print tool versions
|
||||||
RUN bash --version | head -n 1
|
RUN bash --version | head -n 1 \
|
||||||
RUN zsh --version
|
&& zsh --version \
|
||||||
RUN ksh --version || true
|
&& ksh --version || true \
|
||||||
RUN dpkg -s dash | grep ^Version | awk '{print $2}'
|
&& dpkg -s dash | grep ^Version | awk '{print $2}' \
|
||||||
RUN git --version
|
&& git --version \
|
||||||
RUN curl --version
|
&& curl --version \
|
||||||
RUN wget --version
|
&& wget --version \
|
||||||
|
&& shellcheck -V
|
||||||
|
|
||||||
# Add user "nvm" as non-root user
|
# Add user "nvm" as non-root user
|
||||||
RUN useradd -ms /bin/bash nvm
|
RUN useradd -ms /bin/bash nvm
|
||||||
|
|
||||||
|
# Set NVM root dir
|
||||||
|
ARG NVM_DIR=/home/nvm
|
||||||
|
|
||||||
# Copy and set permission for nvm directory
|
# Copy and set permission for nvm directory
|
||||||
COPY . /home/nvm/.nvm/
|
COPY . $NVM_DIR
|
||||||
RUN chown nvm:nvm -R "home/nvm/.nvm"
|
RUN chown nvm:nvm -R $NVM_DIR
|
||||||
|
|
||||||
# Set sudoer for "nvm"
|
# Set sudoer for "nvm"
|
||||||
RUN echo 'nvm ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
RUN echo 'nvm ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
||||||
@ -96,17 +96,17 @@ RUN echo 'nvm ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
|||||||
USER nvm
|
USER nvm
|
||||||
|
|
||||||
# nvm
|
# nvm
|
||||||
RUN echo 'export NVM_DIR="$HOME/.nvm"' >> "$HOME/.bashrc"
|
RUN echo 'export NVM_DIR="${NVM_DIR}/.nvm"' >> "$HOME/.bashrc"
|
||||||
RUN echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> "$HOME/.bashrc"
|
RUN echo '[ -s "${NVM_DIR}/nvm.sh" ] && . "${NVM_DIR}/nvm.sh" # This loads nvm' >> "$HOME/.bashrc"
|
||||||
RUN echo '[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion' >> "$HOME/.bashrc"
|
RUN echo '[ -s "${NVM_DIR}/bash_completion" ] && . "${NVM_DIR}/bash_completion" # This loads nvm bash_completion' >> "$HOME/.bashrc"
|
||||||
|
|
||||||
# nodejs and tools
|
# nodejs and tools
|
||||||
RUN bash -c 'source $HOME/.nvm/nvm.sh && \
|
RUN source $NVM_DIR/nvm.sh \
|
||||||
nvm install node && \
|
&& nvm install node \
|
||||||
npm install -g doctoc urchin eclint dockerfile_lint && \
|
&& npm install -g doctoc urchin eclint dockerfile_lint \
|
||||||
npm install --prefix "$HOME/.nvm/"'
|
&& npm install --prefix $NVM_DIR
|
||||||
|
|
||||||
# Set WORKDIR to nvm directory
|
# Set WORKDIR to nvm directory
|
||||||
WORKDIR /home/nvm/.nvm
|
WORKDIR $NVM_DIR
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/bash"]
|
ENTRYPOINT ["/bin/bash"]
|
||||||
|
Loading…
Reference in New Issue
Block a user