-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
45 lines (36 loc) · 1.65 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
FROM node:16-buster-slim
# 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 gnupg pdftk fontconfig fonts-liberation ca-certificates --no-install-recommends \
# This installs the necessary libs to make the bundled version of Chromium that Puppeteer installs work
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq google-chrome-stable libxss1 --no-install-recommends \
&& wget -O azcopy_v10.tar.gz https://aka.ms/downloadazcopy-v10-linux && tar -xf azcopy_v10.tar.gz --strip-components=1 && rm azcopy_v10.tar.gz \
&& mv ./azcopy /usr/bin/ \
&& rm -rf /var/lib/apt/lists/*
ENV WORK /opt/publisher
# ENV NODE_ENV production # Cannot use until devdependency list is fixed in package.json
# Create app directory
RUN mkdir -p ${WORK}
WORKDIR ${WORK}
# Install app dependencies
COPY yarn.lock package.json ${WORK}/
RUN yarn && yarn cache clean
# Bundle app source
COPY . ${WORK}
ARG BUILD_ENV=prod
COPY .env.${BUILD_ENV} ${WORK}/.env
ARG DIGITRANSIT_APIKEY
ENV DIGITRANSIT_APIKEY=${DIGITRANSIT_APIKEY}
RUN yarn build
EXPOSE 4000
CMD \
./fonts.sh && \
fc-cache -f -v && \
yarn run forever start -c "yarn serve" dist/ && \
yarn run forever start -c "yarn server" ./ && \
yarn run forever start -c "yarn worker" ./ && \
sleep 3 && \
yarn run forever -f logs 1