-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.test
41 lines (32 loc) · 1.38 KB
/
Dockerfile.test
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
ARG NODE_ENV=development
#Builder stage
FROM node:10-slim as builder
ENV NODE_ENV=${NODE_ENV}
COPY package*.json ./
RUN npm install
# Test stage
FROM node:10-slim
ARG USER_ID
ARG GROUP_ID
ENV NODE_ENV=${NODE_ENV}
WORKDIR /usr/src/app
COPY --from=builder node_modules node_modules
COPY . .
# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
# installs, work.
RUN 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 fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Add user so we don't need --no-sandbox.
# same layer as npm install to keep re-chowned files from using up several hundred MBs more space
RUN groupadd -g ${GROUP_ID} -r pptruser \
&& useradd -l -r -u ${USER_ID} -g pptruser -G root pptruser \
&& mkdir -p /home/pptruser/Downloads \
&& chown -R pptruser:pptruser /home/pptruser
# Run everything after as non-privileged user.
USER pptruser
CMD ["npm", "test"]