Skip to content

Commit

Permalink
Add comment explaining the need for separating postinstall from install
Browse files Browse the repository at this point in the history
There are two reasons why we need to run `yarn install --frozen-lockfile` with
the `--ignore-scripts` flag and run `yarn run postinstall` afterwards:
1. Sometimes during installation of the `monitoring` project we were getting
   random failures related to the presence of the `prepare-dependencies.sh`
   script from `threshold-network/solidity-contracts` in the project
   subdependencies. Lately we managed to remove the script from the
   `development`-tagged packages, but the script is still present in `goerli`
   and `mainnet` packages. As `monitoring` project installs `goerli` and
   `mainnet` `@keep-network/tbtc-v2` packages during `yarn install`, the random
   failures may still occur. As a workaround for this problem we will ca run
   install step with the `--ignore-scripts` flag which installs the dependencies
   without running the postinstall scripts (neither in subdependencies nor in
   the main project). We then add a step that executes `yarn run postinstall` -
   this way we still execute any postinstall scripts from the main project
   (currently it's `npm rebuild bcrypto`) script.
2. The `bcoin` holds their `node_modules` in VCS
   (https://github.com/bcoin-org/bcoin/tree/master/node_modules). That means
   `bcrypto` dependency is already here when we run `yarn install`. For an
   unknown reason, `yarn install` does not build all native components in that
   case, hence the need for manual `postinstall` that does it again under the
   hood.
  • Loading branch information
michalinacienciala committed Jul 4, 2023
1 parent 59d86b3 commit 955af2a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions monitoring/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ COPY package.json yarn.lock ./
COPY tsconfig.json ./
COPY src ./src

# Run install and postinstall separatelly to avoid problems with `bcrypto` and
# `install-dependencies.sh`.
RUN yarn install --frozen-lockfile --ignore-scripts
RUN yarn run postinstall

Expand Down

0 comments on commit 955af2a

Please sign in to comment.