Dockerfile 1.5 KB
Newer Older
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
1
FROM node:7
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
2
ENV NPM_CONFIG_LOGLEVEL warn
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
3

4 5
# Installing the 'apt-utils' package gets rid of the 'debconf: delaying package configuration, since apt-utils is not installed'
# error message when installing any other package with the apt-get package manager.
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
6
# https://peteris.rocks/blog/quiet-and-unattended-installation-with-apt-get/
7 8 9 10 11
RUN apt-get update > /dev/null 2>&1 && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
    apt-utils \
  > /dev/null 2>&1 \
  && rm -rf /var/lib/apt/lists/*

Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
12 13
# 1. xvfb depend on xauth
# 2. chromium(with webdriver) depend on libgconf-2-4
14 15
RUN  apt-get update > /dev/null \
  && DEBIAN_FRONTEND=noninteractive apt-get -qqy --no-install-recommends -o Dpkg::Use-Pty=0 install \
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
16
      chromium \
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
17
      figlet \
18
      libgconf-2-4 \
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
19
      vim \
20
      xauth \
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
21 22
      xvfb \
  > /dev/null \
23
  && rm -rf /tmp/* /var/lib/apt/lists/*
24

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

Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
28
COPY package.json .
29 30
RUN  npm --progress=false install > /dev/null \
  && npm --progress=false install -g yarn > /dev/null \
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
31
  && rm -fr /tmp/*
32 33
  # && npm install ts-node typescript -g \

Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
34
COPY . .
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
35
RUN npm --progress false link
36

37 38
# 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.
39
RUN ln -s /root /bot \
40 41 42
  && ln -s /usr/local/lib/node_modules / \
  && ln -s /wechaty/tsconfig.json /

43
VOLUME [ "/bot" ]
44

45

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

RUN npm test