Dockerfile 1.6 KB
Newer Older
1 2 3 4
#
# Wechaty Docker
# https://github.com/wechaty/wechaty
#
5 6 7 8
# FROM alpine
#
# Docker image for Alpine Linux with latest ShellCheck, a static analysis tool for shell scripts.
# https://hub.docker.com/r/nlknguyen/alpine-shellcheck/
9 10
# FROM nlknguyen/alpine-shellcheck
FROM mhart/alpine-node:7
11 12 13
MAINTAINER Zhuophuan LI <zixia@zixia.net>

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

Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
28
RUN mkdir /wechaty
29
WORKDIR /wechaty
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
30

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

38 39
# 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.
40 41
COPY . .
RUN  sed -i '/chromedriver/d' package.json \
42
  && npm run dist \
43
  && npm --silent --progress=false link \
44 45
  \
  && mkdir /bot \
46 47 48
  \
  && (   mkdir /node_modules && cd /node_modules \
      && ln -s /wechaty . \
49
      && ln -s /wechaty/node_modules/* . \
50
    ) \
51
  && ln -s /wechaty/tsconfig.json / \
52 53
  \
  && echo 'Linked wechaty to global'
54

55
VOLUME [ "/bot" ]
56

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

60 61 62 63
LABEL org.label-schema.license=ISC \
      org.label-schema.vcs-ref=master \
      org.label-schema.vcs-url=https://github.com/wechaty/wechaty

64
#RUN npm test