Skip to content

Commit

Permalink
fix(RL-72): sharp dependencies build
Browse files Browse the repository at this point in the history
  • Loading branch information
NoodleOfDeath committed Oct 15, 2023
1 parent 37343c9 commit f4ae8f3
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 13 deletions.
3 changes: 2 additions & 1 deletion Dockerfile.api
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM node:19.3.0 AS base
FROM --platform=linux/amd64 node:19.3.0 AS base

WORKDIR /home/node
COPY src/core ./core
WORKDIR /home/node/app
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.api.local
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM node:19.3.0 AS base
FROM --platform=linux/amd64 node:19.3.0 AS base

WORKDIR /home/node
COPY src/core ./core
WORKDIR /home/node/app
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.mobile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:19.3.0 AS base
FROM --platform=linux/amd64 node:19.3.0 AS base

# install required cli tools
RUN npm i -g tsoa
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.mobile.local
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:19.3.0 AS base
FROM --platform=linux/amd64 node:19.3.0 AS base

# install required cli tools
RUN npm i -g tsoa
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.scheduler
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:19.3.0 AS base
FROM --platform=linux/amd64 node:19.3.0 AS base

# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.scheduler.local
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:19.3.0 AS base
FROM --platform=linux/amd64 node:19.3.0 AS base

# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.web
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:19.3.0 AS base
FROM --platform=linux/amd64 node:19.3.0 AS base

# install required clintools
RUN npm i -g tsoa
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.web.local
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:19.3.0 AS base
FROM --platform=linux/amd64 node:19.3.0 AS base

# install required cli tools
RUN npm i -g tsoa
Expand Down
11 changes: 8 additions & 3 deletions Dockerfile.worker
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
FROM node:19.3.0 AS base
FROM --platform=linux/amd64 node:19.3.0 AS base

# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

# install libvips
RUN apt-get update && apt-get install -y libvips

# install chromium for puppeteer
RUN apt-get update && apt-get install gnupg wget -y && \
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
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 google-chrome-stable -y --no-install-recommends && \
rm -rf /var/lib/apt/lists/*

FROM base AS copy
WORKDIR /home/node
COPY src/core ./core
WORKDIR /home/node/app
COPY src/server/package.json ./
COPY src/server/yarn.lock ./
COPY src/server/src ./src
RUN chown root.root .
RUN yarn install --non-interactive --immutable
RUN npm config set unsafe-perm true
RUN npm rebuild --platform=linux --arch=x64 --verbose sharp

FROM copy AS pre-build
COPY src/server/tsconfig.json ./
Expand All @@ -31,6 +35,7 @@ COPY src/server/gen-sql-queries.ts ./
RUN yarn sql
RUN yarn cp:core
RUN yarn build:worker
RUN find / -name libvips.so.42

FROM build AS worker
CMD yarn start:worker
2 changes: 1 addition & 1 deletion Dockerfile.worker.local
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:19.3.0 AS base
FROM --platform=linux/amd64 node:19.3.0 AS base

# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
Expand Down
2 changes: 1 addition & 1 deletion src/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"build:scheduler": "rimraf dist/serve-scheduler.cjs && esbuild ./src/scheduler --bundle --platform=node --outfile=./dist/serve-scheduler.cjs",
"build:worker": "rimraf dist/serve-worker.cjs && esbuild ./src/worker --bundle --platform=node --outfile=./dist/serve-worker.cjs",
"gen:site": "yarn test gen",
"cp:core": "if [[ -d src/core ]]; then rm -rf src/core; fi && mkdir -p ./src/core/utils && cp -rf ../core/src/utils/* ./src/core/utils && cp -rf ../core/src/client/locales ./src/core/locales",
"cp:core": "if [[ -d src/core ]]; then rm -rf src/core; fi && mkdir -p ./src/core/utils && cp -rf ../core/src/utils/* ./src/core/utils && cp -rf ../core/src/client/locales ./src/core/locales && cp -rf node_modules/sharp/build .",
"sql": "ts-node ./gen-sql-queries",
"test": "jest",
"tsoa": "tsoa spec -c tsoa.config.json",
Expand Down
5 changes: 5 additions & 0 deletions src/server/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6671,6 +6671,11 @@ levn@~0.3.0:
prelude-ls "~1.1.2"
type-check "~0.3.2"

libvips@^0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/libvips/-/libvips-0.0.2.tgz#9c7c87916f5b324358eb721fef8097cbc2644e54"
integrity sha512-E+jHGKSgWuep9t2oFvV9ll6i0YUVVWyNaMgr3zKP4hLYZmaP2qTQeSrGe7tvhUgwcLD8gn2nacgdi1WxMmOJMw==

limiter@^1.1.5:
version "1.1.5"
resolved "https://registry.yarnpkg.com/limiter/-/limiter-1.1.5.tgz#8f92a25b3b16c6131293a0cc834b4a838a2aa7c2"
Expand Down

0 comments on commit f4ae8f3

Please sign in to comment.