-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
84 lines (63 loc) · 2.14 KB
/
Copy pathDockerfile
File metadata and controls
84 lines (63 loc) · 2.14 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
ARG TZ=Asia/Shanghai
ENV LANG=C.UTF-8
ARG PUPPY_USER_ID=999
ARG APP_DIR=/usr/src/app
ARG NODE_VERSION=v20.12.0
ENV NODE_VERSION=$NODE_VERSION
ENV NVM_DIR /usr/src/.nvm
ENV NODE_PATH $NVM_DIR/versions/node/$NODE_VERSION/bin
ENV PATH $NODE_PATH:$PATH
ENV APP_DIR=$APP_DIR
ENV TZ=$TZ
ENV DEBIAN_FRONTEND=$DEBIAN_FRONTEND
ENV HOST=0.0.0.0
ENV PORT=3000
ENV LANG="C.UTF-8"
ENV NODE_ENV=production
ENV DEBUG_COLORS=true
ENV PUPPETEER_SKIP_DOWNLOAD=true
ENV PLAYWRIGHT_BROWSERS_PATH=/usr/local/bin/playwright-browsers
RUN mkdir -p $APP_DIR $NVM_DIR
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
dumb-init \
git \
gnupg \
libu2f-udev \
software-properties-common \
ssh \
wget \
xvfb
RUN curl -sL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash &&\
. $NVM_DIR/nvm.sh &&\
nvm install $NODE_VERSION
RUN add-apt-repository universe && apt-get update && \
apt-get install -y python3.10 python3-pip && \
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 && \
update-alternatives --install /usr/bin/python python /usr/bin/python3 1
RUN groupadd -r puppyuser && useradd --uid ${PUPPY_USER_ID} -r -g puppyuser -G audio,video puppyuser && \
mkdir -p /home/puppyuser/Downloads && \
chown -R puppyuser:puppyuser /home/puppyuser
RUN echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections && \
apt-get -y -qq install software-properties-common &&\
apt-add-repository "deb http://archive.canonical.com/ubuntu $(lsb_release -sc) partner" && \
apt-get -y -qq --no-install-recommends install \
fontconfig \
fonts-freefont-ttf \
fonts-gfs-neohellenic \
fonts-ubuntu \
fonts-wqy-zenhei
WORKDIR $APP_DIR
COPY --chown=pptruser:pptruser ./src .
RUN npx --yes playwright install chromium &&\
npx --yes playwright install-deps chromium &&\
chown -R puppyuser:puppyuser $APP_DIR &&\
fc-cache -f -v && \
apt-get -qq clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/fonts/truetype/noto
RUN npm install
USER puppyuser
EXPOSE 3000
CMD ["node", "index.js"]