Skip to content

Commit

Permalink
fix(build): add missing native modules (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
hairmare authored Jul 9, 2023
1 parent ec7a5de commit 009adf0
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ FROM registry.access.redhat.com/ubi9/nodejs-18:latest AS build
USER 0

# Install yarn
RUN \
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo && \
dnf install -y yarn
RUN curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo \
&& dnf install -y yarn \
&& git config --global --add safe.directory /opt/app-root/src

COPY . .
COPY --from=deps /opt/app-root/src .
Expand Down Expand Up @@ -105,10 +105,15 @@ USER 1001
COPY --from=build /opt/app-root/src/yarn.lock /opt/app-root/src/package.json /opt/app-root/src/packages/backend/dist/skeleton.tar.gz ./
RUN tar xzf skeleton.tar.gz && rm skeleton.tar.gz

# Install production dependencies, ignoring scripts so we don't need a node-gyp toolchain to rebuild isolated-vm
# Install production dependencies, ignoring scripts so we don't need a node-gyp toolchain to rebuild binary modules
RUN yarn install --frozen-lockfile --production --network-timeout 600000 --ignore-scripts && yarn cache clean
# Copy isolated-vm from build stage where we didn't ignore scripts
COPY --from=build --chown=1001:0 /opt/app-root/src/node_modules/isolated-vm ./node_modules/isolated-vm
# Copy binary modules from build stage where we didn't ignore scripts
COPY --from=build --chown=1001:0 \
/opt/app-root/src/node_modules/isolated-vm \
/opt/app-root/src/node_modules/ssh2 \
/opt/app-root/src/node_modules/better-sqlite3 \
/opt/app-root/src/node_modules/cpu-features \
./node_modules/

# Copy the built packages from the build stage
COPY --from=build /opt/app-root/src/packages/backend/dist/bundle.tar.gz .
Expand Down

0 comments on commit 009adf0

Please sign in to comment.