forked from browserless/browserless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (45 loc) · 1.35 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
FROM browserless/base:1.5.0
# Build Args
ARG USE_CHROME_STABLE
ARG PUPPETEER_CHROMIUM_REVISION
ARG PUPPETEER_VERSION
# Application parameters and variables
ENV APP_DIR=/usr/src/app
ENV CONNECTION_TIMEOUT=60000
ENV CHROME_PATH=/usr/bin/google-chrome
ENV HOST=0.0.0.0
ENV IS_DOCKER=true
ENV LANG="C.UTF-8"
ENV NODE_ENV=production
ENV PORT=3000
ENV PUPPETEER_CHROMIUM_REVISION=${PUPPETEER_CHROMIUM_REVISION}
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV USE_CHROME_STABLE=${USE_CHROME_STABLE}
ENV WORKSPACE_DIR=$APP_DIR/workspace
RUN mkdir -p $APP_DIR $WORKSPACE_DIR
WORKDIR $APP_DIR
# Install app dependencies
COPY package.json .
COPY tsconfig.json .
COPY . .
# Install Chrome Stable when specified
RUN if [ "$USE_CHROME_STABLE" = "true" ]; then \
cd /tmp &&\
wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb &&\
dpkg -i google-chrome-stable_current_amd64.deb;\
fi
# Build and install external binaries + assets
RUN if [ "$USE_CHROME_STABLE" = "true" ]; then \
export CHROMEDRIVER_SKIP_DOWNLOAD=false;\
else \
export CHROMEDRIVER_SKIP_DOWNLOAD=true;\
fi &&\
npm i puppeteer@$PUPPETEER_VERSION;\
npm run post-install &&\
npm run build &&\
chown -R blessuser:blessuser $APP_DIR
# Run everything after as non-privileged user.
USER blessuser
# Expose the web-socket and HTTP ports
EXPOSE 3000
CMD ["./start.sh"]