Dockerfile 1.4 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 .
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
29 30
RUN  npm --progress false install > /dev/null \
  && rm -fr /tmp/*
31 32
  # && npm install ts-node typescript -g \

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

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.
RUN mkdir /app && ln -s /usr/local/lib/node_modules /
39 40
VOLUME [ "/app" ]

41 42
ENV TS_NODE_COMPILER_OPTIONS '{"target":"es6"}'

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