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.
parent
3ed47431f8
commit
77da9f5a6d
22
Dockerfile
22
Dockerfile
|
@ -14,6 +14,9 @@ MAINTAINER Peter Dave Hello <hsu@peterdavehello.org>
|
||||||
# Prevent dialog during apt install
|
# Prevent dialog during apt install
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
|
||||||
|
# ShellCheck version
|
||||||
|
ENV SHELLCHECK_VERSION=0.4.7
|
||||||
|
|
||||||
# Pick a Ubuntu apt mirror site for better speed
|
# Pick a Ubuntu apt mirror site for better speed
|
||||||
# ref: https://launchpad.net/ubuntu/+archivemirrors
|
# ref: https://launchpad.net/ubuntu/+archivemirrors
|
||||||
ENV UBUNTU_APT_SITE ubuntu.cs.utah.edu
|
ENV UBUNTU_APT_SITE ubuntu.cs.utah.edu
|
||||||
|
@ -49,14 +52,22 @@ RUN apt update && \
|
||||||
realpath \
|
realpath \
|
||||||
zsh \
|
zsh \
|
||||||
ksh \
|
ksh \
|
||||||
ghc \
|
|
||||||
gcc-4.8 \
|
gcc-4.8 \
|
||||||
g++-4.8 \
|
g++-4.8 \
|
||||||
cabal-install \
|
xz-utils \
|
||||||
build-essential \
|
build-essential \
|
||||||
bash-completion && \
|
bash-completion && \
|
||||||
apt-get clean
|
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
|
# Set locale
|
||||||
RUN locale-gen en_US.UTF-8
|
RUN locale-gen en_US.UTF-8
|
||||||
|
|
||||||
|
@ -68,7 +79,6 @@ RUN dpkg -s dash | grep ^Version | awk '{print $2}'
|
||||||
RUN git --version
|
RUN git --version
|
||||||
RUN curl --version
|
RUN curl --version
|
||||||
RUN wget --version
|
RUN wget --version
|
||||||
RUN cabal --version
|
|
||||||
|
|
||||||
# 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
|
||||||
|
@ -79,12 +89,6 @@ RUN echo 'nvm ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
||||||
# Switch to user "nvm" from now
|
# Switch to user "nvm" from now
|
||||||
USER nvm
|
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
|
# nvm
|
||||||
COPY . /home/nvm/.nvm/
|
COPY . /home/nvm/.nvm/
|
||||||
RUN sudo chown nvm:nvm -R $HOME/.nvm
|
RUN sudo chown nvm:nvm -R $HOME/.nvm
|
||||||
|
|
Loading…
Reference in New Issue