-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile
63 lines (54 loc) · 1.98 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
57
58
59
60
61
62
63
# WechatyBlinder
# https://github.com/zixia/wechaty-blinder
#
FROM zixia/facenet
LABEL maintainer="Huan LI <zixia@zixia.net>"
RUN sudo apt-get update \
&& sudo apt-get install -y --no-install-recommends \
build-essential \
dumb-init \
fonts-arphic-ukai \
fonts-dejavu-core \
fonts-wqy-zenhei \
fontconfig \
fontconfig-config \
git \
jq \
libfontconfig1 \
moreutils \
ttf-freefont \
ttf-wqy-zenhei \
ucf \
&& sudo apt-get purge --auto-remove \
&& sudo rm -rf /tmp/* /var/lib/apt/lists/*
# https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
# https://github.com/ebidel/try-puppeteer/blob/master/backend/Dockerfile
# Install latest chrome dev package.
# Note: this also installs the necessary libs so we don't need the previous RUN command.
RUN curl -sL https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - \
&& sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& sudo apt-get update \
&& sudo apt-get install -y --no-install-recommends \
google-chrome-unstable \
&& sudo apt-get purge --auto-remove \
&& sudo rm -rf /tmp/* /var/lib/apt/lists/* \
&& sudo rm -rf /usr/bin/google-chrome* /opt/google/chrome*
RUN [ -e /workdir ] || sudo mkdir /workdir \
&& sudo chown -R "$(id -nu)" /workdir
VOLUME /workdir
RUN [ -e /blinder ] || sudo mkdir /blinder \
&& sudo chown -R "$(id -nu)" /blinder
WORKDIR /blinder
# for better image cache: no need to install wechaty again when we updating wechaty-blinder only.
RUN npm init -y > /dev/null \
&& npm install wechaty \
&& rm -fr /tmp/* ~/.npm
COPY package.json .
RUN sudo chown "$(id -nu)" package.json \
&& jq 'del(.dependencies.facenet)' package.json | sponge package.json \
&& npm install \
&& rm -fr /tmp/* ~/.npm
COPY . .
RUN npm run dist
ENTRYPOINT [ "/usr/bin/dumb-init", "--" ]
CMD [ "node", "dist/bin/bot" ]