-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile_CI
66 lines (51 loc) · 2.7 KB
/
Dockerfile_CI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# THIS DOCKERFILE IS USED FOR CONTINUOUS INTEGRATION AND DEPLOYMENT TESTING.
# Start with Node 12.X and the Debian Linux 'Stretch Slim' image.
FROM node:12.20.1-stretch-slim
# Grab the latest package definitions for apt-get
RUN apt-get update && apt-get install -y gnupg2
# Add git because some of TIBET's npm packages come from TPI forks of Git
# packages on Github (force 'yes' or otherwise Docker can't complete building
# the package).
RUN apt-get -y install git-core
# Add the prerequisites for Puppeteer.
RUN apt-get update \
# Install latest chrome dev package, which installs the necessary libs to
# make the bundled version of Chromium that Puppeteer installs work.
&& apt-get install -y wget --no-install-recommends \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-unstable --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& wget --quiet https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -O /usr/sbin/wait-for-it.sh \
&& chmod +x /usr/sbin/wait-for-it.sh
# Add the non-root 'tester' user.
RUN useradd -ms /bin/bash tester
# cd into the 'tester' user's home directory.
WORKDIR /home/tester
# Copy just the package.json here. We'll need to install Puppeteer here since,
# as a binary, it needs to be installed for the container. We don't want the
# version that was installed in the host environment (which might not be Linux,
# which is what this container image is defining).
COPY --chown=node:node package.json .
# Go ahead and install the container-specific version of Puppeteer here. Since
# the COPY below will only copy *new* files, this won't be overwritten when the
# node_modules directory is copied from the host into this container.
RUN npm install puppeteer
# Copy in the contents of TIBET from the local source directory into the
# Docker image's app directory. By specifying the '--chown' flag, we ensure that
# everything gets the proper permissions.
COPY --chown=node:node . .
# Relink TIBET so that everything that needs to be installed and linked is
# indeed linked.
RUN npm link
# Make sure to build the hook file so that it's available to the CI system.
RUN tibet build_hook
# Make sure to build the loader so that it's available to the CI system.
RUN tibet build_loader
# Make sure to build the workers so that they're available to the CI system.
RUN tibet build_workers
# Switch to the non-root 'tester' user.
USER tester
# Set an entrypoint to bash and we're ready to go!
ENTRYPOINT /usr/local/bin/tibet test