mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
42 lines
1.8 KiB
Bash
42 lines
1.8 KiB
Bash
#!/bin/env bash
|
|
|
|
# install nvm
|
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
|
|
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
|
|
|
# install Node.js v8.12
|
|
export NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node
|
|
nvm install 8.12
|
|
|
|
# create soft links
|
|
ln -s $HOME/.nvm/versions/node/v8.12.0/bin/npm /usr/local/bin/npm
|
|
ln -s $HOME/.nvm/versions/node/v8.12.0/bin/node /usr/local/bin/node
|
|
|
|
# environments manipulation
|
|
export NODE_PATH=$HOME.nvm/versions/node/v8.12.0/lib/node_modules
|
|
export PATH=$NODE_PATH:$PATH
|
|
|
|
# install chromium
|
|
# See https://crbug.com/795759
|
|
RUN apt-get update && apt-get install -yq libgconf-2-4
|
|
|
|
# Install latest chrome dev package and fonts to support major
|
|
# charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
|
|
# Note: this installs the necessary libs to make the bundled version
|
|
# of Chromium that Puppeteer
|
|
# installs, work.
|
|
RUN apt-get update && apt-get install -y wget --no-install-recommends \
|
|
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
|
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
|
|
&& apt-get update \
|
|
&& apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
|
|
--no-install-recommends \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& apt-get purge --auto-remove -y curl \
|
|
&& rm -rf /src/*.deb
|
|
|
|
# install default dependencies
|
|
PUPPETEER_DOWNLOAD_HOST=https://npm.taobao.org/mirrors
|
|
npm install puppeteer-chromium-resolver crawlab-sdk -g --unsafe-perm=true --registry=https://registry.npm.taobao.org
|