Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(superchain): install both Node 10 and Node 14 #2718

Merged
merged 4 commits into from
Mar 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions superchain/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,27 @@ RUN amazon-linux-extras install docker
&& yum clean all && rm -rf /var/cache/yum
VOLUME /var/lib/docker

# Install Node 10+
RUN curl -sL https://rpm.nodesource.com/setup_10.x | bash - \
&& yum -y install nodejs \
&& yum clean all && rm -rf /var/cache/yum \
# Install Node using NVM (Node Version Manager) so we can have multiple Node versions installed and easily switch
# between them.
ENV NVM_DIR /usr/local/nvm

RUN mkdir -p $NVM_DIR && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash - \
&& echo 'source "$NVM_DIR/nvm.sh"' >> $HOME/.bash_profile

# Because we wrote things to .bash_profile, make the default shell a login shell so it gets sourced.
# Also set BASH_ENV to make bash source this EVEN if it's not a login shell (later on when the container
# gets executed)
SHELL [ "/bin/bash", "--login", "-c" ]
ENV BASH_ENV /root/.bash_profile

# Source NVM into this shell and install Node 10 and 14. First installed version (10) becomes default.
RUN nvm install 10 \
&& nvm install 14 \
&& npm set unsafe-perm true

# Install Yarn
RUN curl -sSL https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo \
&& yum -y install yarn \
&& yum clean all && rm -rf /var/cache/yum
# Can't install Yarn using yum anymore now that we're using nvm, so install it using NPM
RUN nvm exec 10 npm install -g yarn \
&& nvm exec 14 npm install -g yarn

# Install some configuration
COPY ssh_config /root/.ssh/config
Expand All @@ -113,4 +124,4 @@ LABEL org.opencontainers.image.created=${BUILD_TIMESTAMP}
org.opencontainers.image.revision=$COMMIT_ID \
org.opencontainers.image.authors="Amazon Web Services (https://aws.amazon.com)"

CMD ["/bin/bash"]
CMD ["/bin/bash", "--login"]