Dockerfile 1.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
#
# Wechaty Docker
# https://github.com/wechaty/wechaty
#
FROM alpine
MAINTAINER Zhuophuan LI <zixia@zixia.net>

RUN  apk update && apk upgrade \
  && apk add nodejs \
      bash \
      ca-certificates \
      chromium-chromedriver \
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
13
      chromium \
14
      coreutils \
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
15
      figlet \
16
      udev \
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
17
      vim \
18
      xauth \
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
19
      xvfb \
20
  && rm -rf /tmp/* /var/cache/apk/*
21

Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
22
RUN mkdir /wechaty
23
WORKDIR /wechaty
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
24

25 26
# npm `chromedriver` not support alpine linux
# https://github.com/giggio/node-chromedriver/issues/70
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
27
COPY package.json .
28 29
RUN  sed -i '/chromedriver/d' package.json \
  && npm --progress=false install > /dev/null \
30
  && rm -fr /tmp/* ~/.npm
31

Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
32
COPY . .
33 34
RUN  sed -i '/chromedriver/d' package.json \
  && npm --progress=false link
35

36 37
# Loading from node_modules Folders: https://nodejs.org/api/modules.html
# If it is not found there, then it moves to the parent directory, and so on, until the root of the file system is reached.
38
RUN mkdir /bot \
39
  && ln -s /usr/local/lib/node_modules / \
40 41
  && ln -s /wechaty/tsconfig.json / \
  && ln -s /wechaty/bin/xvfb-run /usr/local/bin
42

43
VOLUME [ "/bot" ]
44

45
ENTRYPOINT [ "/wechaty/bin/entrypoint.sh" ]
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
46
CMD [ "start" ]
47

48
#RUN npm test