-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathDockerfile
56 lines (48 loc) · 1.6 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
53
54
55
56
# based on: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
FROM docker.io/library/node:18-buster-slim
LABEL maintainer="Jihchi Lee <[email protected]>"
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
RUN apt-get update \
&& apt-get -yq upgrade \
&& apt-get install -y curl gnupg \
&& curl -sSL https://dl.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' \
&& sed -i -e's/ main/ main contrib non-free/g' /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y \
google-chrome-stable \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
fonts-freefont-ttf \
ttf-mscorefonts-installer \
fonts-noto-cjk \
fonts-noto-color-emoji \
fonts-font-awesome \
libxss1 \
fontconfig \
--no-install-recommends \
&& fc-cache -f -v \
&& apt-get autoremove -y \
&& apt-get autoclean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /src/*.deb
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
# node application onbuild
RUN corepack enable
# pnpm fetch does require only lockfile
COPY pnpm-lock.yaml ./
RUN pnpm fetch --prod
COPY . ./
RUN pnpm install -r --offline --prod
# 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 usermod -a -G audio,video node \
&& mkdir -p /home/node/Downloads \
&& chown -R node:node /home/node /usr/src/app/
USER node
RUN corepack pack
CMD ["pnpm", "start"]
EXPOSE 3000