Skip to content

Enables set different Node versions in Testkit Dockerfile #840

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

Merged
merged 2 commits into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion packages/testkit-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"type": "module",
"scripts": {
"build": "rollup src/index.js --config rollup.config.js",
"start": "node -r esm src/index.js",
"start": "node --version | grep -q v10. && node -r esm src/index.js || node --experimental-specifier-resolution=node src/index.js",
"clean": "rm -fr node_modules public/index.js",
"prepare": "npm run build"
},
Expand Down
29 changes: 23 additions & 6 deletions testkit/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
FROM ubuntu:20.04

ARG NODE_VERSION=10

ENV DEBIAN_FRONTEND noninteractive
ENV NODE_OPTIONS --max_old_space_size=4096
ENV NODE_OPTIONS --max_old_space_size=4096 --use-openssl-ca

# Configuring NodeJS version
RUN apt-get clean

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y curl

RUN curl -sL https://deb.nodesource.com/setup_${NODE_VERSION:=10}.x | sh

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
git \
curl \
python3 \
nodejs \
npm \
firefox \
nodejs \
&& rm -rf /var/lib/apt/lists/*

RUN npm install -g npm@7 \
&& /bin/bash -c "hash -d npm"
RUN /bin/bash -c "hash -d npm"

# Enable tls v1.0
RUN echo "openssl_conf = openssl_configuration\n"|cat - /etc/ssl/openssl.cnf > /tmp/openssl_conf.cnf \
Expand All @@ -31,14 +42,20 @@ CipherString = DEFAULT:@SECLEVEL=1" >> /etc/ssl/openssl.cnf
COPY CAs/* /usr/local/share/ca-certificates/
# Store custom CAs somewhere where the backend can find them later.
COPY CustomCAs/* /usr/local/share/custom-ca-certificates/
RUN update-ca-certificates

RUN update-ca-certificates --verbose

# Creating an user for building the driver and running the tests
RUN useradd -m driver && echo "driver:driver" | chpasswd && adduser driver sudo
VOLUME /driver
RUN chown -Rh driver:driver /driver
RUN chown -Rh driver:driver /home/driver
WORKDIR /home/driver

USER driver
WORKDIR /home/driver
CMD /bin/bash
RUN mkdir /home/driver/.npm_global
RUN npm config set prefix /home/driver/.npm_global

RUN node --version
RUN npm --version