1cb93a386Sopenharmony_ci# Docker container with Chrome, and karma/jasmine, to be used to run JS tests.
2cb93a386Sopenharmony_ci# Inspired by https://github.com/eirslett/chrome-karma-docker
3cb93a386Sopenharmony_ci#
4cb93a386Sopenharmony_ci# Tests will be run as non-root (user skia, in fact), so /OUT should have permissions
5cb93a386Sopenharmony_ci# 777 so as to be able to create output there.
6cb93a386Sopenharmony_ci
7cb93a386Sopenharmony_ciFROM node:14.15
8cb93a386Sopenharmony_ci
9cb93a386Sopenharmony_ciRUN apt-get update && apt-get upgrade -y
10cb93a386Sopenharmony_ci
11cb93a386Sopenharmony_ciRUN wget https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64.deb
12cb93a386Sopenharmony_ciRUN dpkg -i dumb-init_*.deb
13cb93a386Sopenharmony_ci
14cb93a386Sopenharmony_ciENTRYPOINT ["/usr/bin/dumb-init", "--"]
15cb93a386Sopenharmony_ci
16cb93a386Sopenharmony_ciRUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
17cb93a386Sopenharmony_ciRUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
18cb93a386Sopenharmony_ciRUN apt-get update && apt-get install -y google-chrome-stable
19cb93a386Sopenharmony_ci
20cb93a386Sopenharmony_ci#Add user so we don't have to run as root (prevents us from over-writing files in /SRC)
21cb93a386Sopenharmony_ciRUN groupadd -g 2000 skia \
22cb93a386Sopenharmony_ci    && useradd -u 2000 -g 2000 skia \
23cb93a386Sopenharmony_ci    && mkdir -p /home/skia \
24cb93a386Sopenharmony_ci    && chown -R skia:skia /home/skia
25cb93a386Sopenharmony_ci
26cb93a386Sopenharmony_ci# These directories can be used for mounting a source checkout and having a place to put outputs.
27cb93a386Sopenharmony_ciRUN mkdir -m 0777 /SRC /OUT
28cb93a386Sopenharmony_ci
29cb93a386Sopenharmony_ci# Run everything after as non-privileged user.
30cb93a386Sopenharmony_ciUSER skia
31cb93a386Sopenharmony_ci
32cb93a386Sopenharmony_ciWORKDIR /home/skia