Skip to content

Commit

Permalink
chore(web-scraper, build): use Node.js 22 in the base image
Browse files Browse the repository at this point in the history
  • Loading branch information
azasypkin committed Aug 31, 2024
1 parent 07b0ded commit 073e75e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
14 changes: 11 additions & 3 deletions Dockerfile.web-scraper
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM node:20-alpine3.20 AS builder
FROM --platform=$BUILDPLATFORM node:22-alpine3.20 AS builder
WORKDIR /app

# Copy workspace root `package.json` and `package-lock.json` files,
Expand All @@ -12,13 +12,19 @@ COPY ["./components/web_scraper", "./components/web_scraper"]
RUN set -x && npm test --ws
RUN set -x && npm run build --ws

FROM node:20-alpine3.20
FROM node:22-alpine3.20
ENV NODE_ENV=production \
RETRACK_WEB_SCRAPER_BROWSER_EXECUTABLE_PATH="/usr/bin/chromium-browser"
WORKDIR /app
EXPOSE 7272

RUN set -x && apk update --no-cache && \
apk upgrade --no-cache && \
apk add --no-cache dumb-init nss freetype harfbuzz ca-certificates ttf-freefont chromium
apk add --no-cache dumb-init ttf-freefont font-noto-emoji font-wqy-zenhei chromium-swiftshader chromium

COPY ./dev/docker/chromium-local.conf /etc/fonts/local.conf
RUN set -x && fc-cache -fv

COPY --from=builder ["/app/components/web_scraper/dist/", "./"]
COPY --from=builder ["/app/components/web_scraper/package.json", "/app/package-lock.json", "./"]

Expand All @@ -28,4 +34,6 @@ RUN set -x && npm ci --production && npm cache clean --force && \
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 [ "node", "src/index.js" ]
2 changes: 1 addition & 1 deletion Dockerfile.web-scraper.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
node_modules
.idea
.DS_Store
dev
dev/api
.parcel-cache
target
dist
Expand Down
31 changes: 31 additions & 0 deletions dev/docker/chromium-local.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

<alias>
<family>sans-serif</family>
<prefer>
<family>FreeSans</family>
<family>Noto Color Emoji</family>
<family>Noto Emoji</family>
</prefer>
</alias>

<alias>
<family>serif</family>
<prefer>
<family>FreeSerif</family>
<family>Noto Color Emoji</family>
<family>Noto Emoji</family>
</prefer>
</alias>

<alias>
<family>monospace</family>
<prefer>
<family>FreeMono</family>
<family>Noto Color Emoji</family>
<family>Noto Emoji</family>
</prefer>
</alias>
</fontconfig>

0 comments on commit 073e75e

Please sign in to comment.