Dockerfile 1.5 KB
Newer Older
1 2 3 4
#
# Wechaty Docker
# https://github.com/wechaty/wechaty
#
5 6 7 8 9
# 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/
FROM nlknguyen/alpine-shellcheck
10 11 12 13 14 15 16
MAINTAINER Zhuophuan LI <zixia@zixia.net>

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

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

29 30
# npm `chromedriver` not support alpine linux
# https://github.com/giggio/node-chromedriver/issues/70
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
31
COPY package.json .
32 33
RUN  sed -i '/chromedriver/d' package.json \
  && npm --progress=false install > /dev/null \
34
  && rm -fr /tmp/* ~/.npm
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 39
COPY . .
RUN  sed -i '/chromedriver/d' package.json \
40
  && npm run build \
41 42 43
  && npm --progress=false link \
  \
  && mkdir /bot \
44 45
  && mkdir /node_modules \
  && ln -s /wechaty /node_modules \
46
  && ln -s /wechaty/tsconfig.json / \
47 48
  \
  && echo 'Linked wechaty to global'
49

50
VOLUME [ "/bot" ]
51

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

55 56 57 58
LABEL org.label-schema.license=ISC \
      org.label-schema.vcs-ref=master \
      org.label-schema.vcs-url=https://github.com/wechaty/wechaty

59
#RUN npm test