-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
101 lines (67 loc) · 1.74 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
FROM node:20.2.0-alpine3.18 as base
MAINTAINER support@68publishers.io
ENV PUPPETEER_SKIP_DOWNLOAD=true
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV APP_PORT=3000
ENV CRAWLEE_STORAGE_DIR=./var/crawlee
ENV CHROME_PATH=/usr/bin/chromium-browser
ENV WORKER_PROCESSES=5
ENV SENTRY_SERVER_NAME=crawler
RUN mkdir -p /app
RUN mkdir -p /home/node
RUN chown -R node:node /app && chmod -R 770 /app
RUN chown -R node:node /home/node
WORKDIR /app
COPY --chown=node:node package*.json ./
COPY --chown=node:node . .
EXPOSE 3000
FROM base as base-with-chrome
RUN apk --no-cache -U upgrade
RUN apk add --update --no-cache \
chromium>114.0.5735.132 \
nss \
udev \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont
RUN mkdir -p /home/node/Downloads
FROM base as dev-app
ENV NODE_ENV=development
USER node
RUN npm i
ENTRYPOINT ["npm", "run", "dev:app"]
FROM base as dev-scheduler
ENV NODE_ENV=development
USER node
RUN npm i
ENTRYPOINT ["npm", "run", "dev:scheduler"]
FROM base-with-chrome as dev-worker
ENV NODE_ENV=development
USER node
RUN npm i
ENTRYPOINT ["npm", "run", "dev:worker"]
FROM base-with-chrome as prod-all
ENV NODE_ENV=production
RUN npm i -g pm2
USER node
RUN npm ci --omit=dev
ENTRYPOINT ["pm2-runtime", "./.docker/pm2/process.all.yml"]
FROM base as prod-app
ENV NODE_ENV=production
RUN npm i -g pm2
USER node
RUN npm ci --omit=dev
ENTRYPOINT ["pm2-runtime", "./.docker/pm2/process.app.yml"]
FROM base as prod-scheduler
ENV NODE_ENV=production
RUN npm i -g pm2
USER node
RUN npm ci --omit=dev
ENTRYPOINT ["pm2-runtime", "./.docker/pm2/process.scheduler.yml"]
FROM base-with-chrome as prod-worker
ENV NODE_ENV=production
RUN npm i -g pm2
USER node
RUN npm ci --omit=dev
ENTRYPOINT ["pm2-runtime", "./.docker/pm2/process.worker.yml"]