mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 14:21:50 +00:00
Optimize ShellCheck installation in Docker image
Use pre-built static release binary instead of building ShellCheck from the source code, this change would save disk space, time, and much computing resources.
This commit is contained in:
parent
3ed47431f8
commit
77da9f5a6d
22
Dockerfile
22
Dockerfile
@ -14,6 +14,9 @@ MAINTAINER Peter Dave Hello <hsu@peterdavehello.org>
|
||||
# Prevent dialog during apt install
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
# ShellCheck version
|
||||
ENV SHELLCHECK_VERSION=0.4.7
|
||||
|
||||
# Pick a Ubuntu apt mirror site for better speed
|
||||
# ref: https://launchpad.net/ubuntu/+archivemirrors
|
||||
ENV UBUNTU_APT_SITE ubuntu.cs.utah.edu
|
||||
@ -49,14 +52,22 @@ RUN apt update && \
|
||||
realpath \
|
||||
zsh \
|
||||
ksh \
|
||||
ghc \
|
||||
gcc-4.8 \
|
||||
g++-4.8 \
|
||||
cabal-install \
|
||||
xz-utils \
|
||||
build-essential \
|
||||
bash-completion && \
|
||||
apt-get clean
|
||||
|
||||
# ShellCheck with Ubuntu 14.04 container workaround
|
||||
RUN wget https://storage.googleapis.com/shellcheck/shellcheck-v$SHELLCHECK_VERSION.linux.x86_64.tar.xz -O- | \
|
||||
tar xJvf - shellcheck-v$SHELLCHECK_VERSION/shellcheck && \
|
||||
mv shellcheck-v$SHELLCHECK_VERSION/shellcheck /bin && \
|
||||
rmdir shellcheck-v$SHELLCHECK_VERSION && \
|
||||
touch /tmp/libc.so.6 && \
|
||||
echo "alias shellcheck='LD_LIBRARY_PATH=/tmp /bin/shellcheck'" >> /etc/bash.bashrc
|
||||
RUN LD_LIBRARY_PATH=/tmp shellcheck -V
|
||||
|
||||
# Set locale
|
||||
RUN locale-gen en_US.UTF-8
|
||||
|
||||
@ -68,7 +79,6 @@ RUN dpkg -s dash | grep ^Version | awk '{print $2}'
|
||||
RUN git --version
|
||||
RUN curl --version
|
||||
RUN wget --version
|
||||
RUN cabal --version
|
||||
|
||||
# Add user "nvm" as non-root user
|
||||
RUN useradd -ms /bin/bash nvm
|
||||
@ -79,12 +89,6 @@ RUN echo 'nvm ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
||||
# Switch to user "nvm" from now
|
||||
USER nvm
|
||||
|
||||
# Shellcheck
|
||||
RUN cabal update
|
||||
RUN cabal install ShellCheck
|
||||
RUN ~/.cabal/bin/shellcheck --version
|
||||
RUN echo 'export PATH="~/.cabal/bin/:${PATH}"' >> $HOME/.bashrc
|
||||
|
||||
# nvm
|
||||
COPY . /home/nvm/.nvm/
|
||||
RUN sudo chown nvm:nvm -R $HOME/.nvm
|
||||
|
Loading…
Reference in New Issue
Block a user