-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.web-scraper
41 lines (32 loc) · 1.54 KB
/
Dockerfile.web-scraper
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
FROM --platform=$BUILDPLATFORM node:22-alpine3.21 AS builder
WORKDIR /app
# Copy workspace root `package.json` and `package-lock.json` files,
# and `package.json` file from the component, to just install dependencies.
COPY ["./*.json", "./"]
COPY ["./components/retrack-web-scraper/package.json", "./components/retrack-web-scraper/"]
RUN set -x && npm ci --ws
# Now copy the rest of the component files, test and build it.
COPY ["./components/retrack-web-scraper", "./components/retrack-web-scraper"]
RUN set -x && npm test --ws
RUN set -x && npm run build --ws
FROM node:22-alpine3.21
ENV NODE_ENV=production \
RETRACK_WEB_SCRAPER_BROWSER_EXECUTABLE_PATH="/usr/bin/chromium-browser" \
DISPLAY=:99
WORKDIR /app
EXPOSE 7272
RUN set -x && apk update --no-cache && \
apk upgrade --no-cache && \
apk add --no-cache dumb-init ttf-freefont font-noto-emoji font-wqy-zenhei xvfb-run chromium-swiftshader chromium
COPY ./dev/docker/chromium-local.conf /etc/fonts/local.conf
RUN set -x && fc-cache -fv
COPY --from=builder ["/app/components/retrack-web-scraper/dist/", "./"]
COPY --from=builder ["/app/components/retrack-web-scraper/package.json", "/app/package-lock.json", "./"]
# Install production dependencies and clean up.
RUN set -x && npm ci --production && npm cache clean --force && \
rm -rf /usr/local/lib/node_modules && \
rm -rf /opt/yarn-* \
rm /usr/local/bin/npm /usr/local/bin/npx /usr/local/bin/yarn
USER node
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD xvfb-run --auto-servernum --server-args='-screen 0 1280x720x24' node src/index.js