Home | History | Annotate | Download | only in karma-chrome-tests
      1 # Docker container with Chrome, and karma/jasmine, to be used to run JS tests.
      2 # Inspired by https://github.com/eirslett/chrome-karma-docker
      3 #
      4 # Tests will be run as non-root (user skia, in fact), so /OUT should have permissions
      5 # 777 so as to be able to create output there.
      6 
      7 FROM node:8.11
      8 
      9 RUN apt-get update && apt-get upgrade -y
     10 
     11 RUN wget https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64.deb
     12 RUN dpkg -i dumb-init_*.deb
     13 
     14 ENTRYPOINT ["/usr/bin/dumb-init", "--"]
     15 
     16 RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
     17 RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
     18 RUN apt-get update && apt-get install -y google-chrome-stable
     19 
     20 RUN npm install --global jasmine-core (a] 3.1.0 karma (a] 2.0.5 \
     21         karma-chrome-launcher (a] 2.2.0 karma-jasmine (a] 1.1.2 requirejs (a] 2.3.5 \
     22         is-docker (a] 1.1.0
     23 
     24 # Allows require('is-docker') or require('karma') to work from anywhere.
     25 # https://stackoverflow.com/a/15646750
     26 ENV NODE_PATH=/usr/local/lib/node_modules
     27 
     28 #Add user so we don't have to run as root (prevents us from over-writing files in /SRC)
     29 RUN groupadd -g 2000 skia \
     30     && useradd -u 2000 -g 2000 skia \
     31     && mkdir -p /home/skia \
     32     && chown -R skia:skia /home/skia
     33 
     34 # These directories can be used for mounting a source checkout and having a place to put outputs.
     35 RUN mkdir -m 0777 /SRC /OUT
     36 
     37 # Run everything after as non-privileged user.
     38 USER skia
     39 
     40 WORKDIR /home/skia