Skip to content

Instantly share code, notes, and snippets.

@breezeight
Last active December 9, 2018 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save breezeight/6273df9026c513aaf995560e74fe2c07 to your computer and use it in GitHub Desktop.
Save breezeight/6273df9026c513aaf995560e74fe2c07 to your computer and use it in GitHub Desktop.
asdf-nodejs-issue-107.dockerfile
FROM debian:stretch-slim
#Set default shell to bash
RUN ln -f -s /bin/bash /bin/sh
# utf8.
ENV LANG=C.UTF-8
# DISTRO BASE PACKAGES UPGRADE and BASE PACKAGES
RUN apt-get update -qq && \
apt-get upgrade -qq -y && \
apt-get install --no-install-recommends -qq -y \
ca-certificates \
procps && \
rm -rf /var/cache/debconf/*-old && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /usr/share/doc/*
# Install ASDF
ARG ASDF_VERSION=v0.5.1
ENV ASDF_VERSION=$ASDF_VERSION
ENV PATH $HOME_DIR/.asdf/bin:$HOME_DIR/.asdf/shims:$PATH
RUN apt-get update -qq && \
apt-get install --no-install-recommends -qq -y git && \
git clone --depth 1 https://github.com/asdf-vm/asdf.git $HOME_DIR/.asdf --branch $ASDF_VERSION && \
echo -e '\n. $HOME_DIR/.asdf/asdf.sh' >> $HOME_DIR/.bashrc && \
echo -e '\n. $HOME_DIR/.asdf/completions/asdf.bash' >> $HOME_DIR/.bashrc && \
rm -rf /var/cache/debconf/*-old && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /usr/share/doc/*
ARG ADDITIONAL_BUILD_PACKAGES
ENV ADDITIONAL_BUILD_PACKAGES=$ADDITIONAL_BUILD_PACKAGES
RUN set -ex && \
buildDeps=" \
autoconf \
bison \
dpkg-dev \
gcc \
libbz2-dev \
libgdbm-dev \
libglib2.0-dev \
libncurses-dev \
libreadline-dev \
libxml2-dev \
libxslt-dev \
make \
wget \
xz-utils \
libssl-dev \
libyaml-dev \
git-core \
$ADDITIONAL_BUILD_PACKAGES" && \
apt-get update && \
apt-get install -y --no-install-recommends $buildDeps
#NODEJS ASDF
ARG NODE_VERSION=8.12.0
ENV NODE_VERSION=$NODE_VERSION
# Always update to the latest npm version
RUN buildDeps='gnupg dirmngr curl' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs.git
RUN bash $HOME_DIR/.asdf/plugins/nodejs/bin/import-release-team-keyring
RUN asdf install nodejs $NODE_VERSION \
&& rm -rf /tmp/* \
&& apt-get purge -y --auto-remove $buildDeps \
&& asdf global nodejs $NODE_VERSION \
&& npm install -g npm \
&& asdf reshim nodejs
RUN asdf global nodejs $NODE_VERSION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment