Created
May 24, 2021 15:18
-
-
Save garth/48eabf4b433491501fb97887f6fe8098 to your computer and use it in GitHub Desktop.
Docker image roughly based on the offical node images, but with support for projects with mixed node versions via Volta
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:buster | |
# curl and ca-certificates are needed for volta installation | |
# git, python and build-essential are needed for legacy package dependencies | |
RUN apt-get update \ | |
&& apt-get install -y \ | |
curl \ | |
ca-certificates \ | |
git \ | |
python \ | |
build-essential \ | |
--no-install-recommends | |
RUN groupadd --gid 1000 node \ | |
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node | |
# bash will load volta() function via .bashrc | |
# using $VOLTA_HOME/load.sh | |
SHELL ["/bin/bash", "-c"] | |
# since we're starting non-interactive shell, | |
# we wil need to tell bash to load .bashrc manually | |
ENV BASH_ENV ~/.bashrc | |
# needed by volta() function | |
ENV VOLTA_HOME /node/.volta | |
# make sure packages managed by volta will be in PATH | |
ENV PATH $VOLTA_HOME/bin:$PATH | |
# install volta | |
RUN curl https://get.volta.sh | bash | |
RUN volta install node | |
RUN volta install yarn | |
CMD [ "node" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment