forked from HSLdevcom/hsl-routemap-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (40 loc) · 1.54 KB
/
Dockerfile
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
FROM node:12
# This installs the necessary libs to make the bundled version of Chromium that Pupppeteer installs work
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq wget curl pdftk libgconf-2-4 --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 \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq $(apt-cache depends google-chrome-unstable | awk '/Depends:/{print$2}') --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /src/*.deb
# Install Azure CLI to download the fonts
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash
ENV WORK /opt/publisher
# Create app directory
RUN mkdir -p ${WORK}
WORKDIR ${WORK}
# Add privileges for puppeteer user
RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
&& mkdir -p /home/pptruser/Downloads \
&& chown -R pptruser:pptruser /home/pptruser \
&& chown -R pptruser:pptruser ${WORK}
# Run user as non privileged.
USER pptruser
# Install app dependencies
COPY yarn.lock ${WORK}
COPY package.json ${WORK}
RUN yarn
# Bundle app source
COPY . ${WORK}
ARG BUILD_ENV=production
COPY .env.${BUILD_ENV} ${WORK}/.env
RUN yarn build
EXPOSE 4000
CMD \
./fonts.sh && \
fc-cache -f -v && \
yarn run forever start -c "yarn serve" ./ && \
yarn run forever start -c "yarn server" ./ && \
sleep 3 && \
yarn run forever -f logs 1