Repository navigation
Closed
Description
Bug Report
Issue description
This should not recompile everything when pruning dev dependencies.
Lines 121 to 134 in 07c206e
| case 'postinstall': | |
| { | |
| if (!isWindows) | |
| { | |
| execute('make -C worker'); | |
| } | |
| else if (!process.env.MEDIASOUP_WORKER_BIN) | |
| { | |
| execute(`${PYTHON} ./worker/scripts/configure.py --format=msvs -R mediasoup-worker`); | |
| execute(`${MSBUILD} ./worker/mediasoup-worker.sln /p:Configuration=${MEDIASOUP_BUILDTYPE}`); | |
| } | |
| break; | |
| } |
My Dockerfile looks like this:
Details
FROM node:13
WORKDIR /code
COPY .npmrc /code/.npmrc
COPY package.json /code/package.json
COPY package-lock.json /code/package-lock.json
RUN ["npm", "ci"]
FROM node:13
WORKDIR /code
COPY --from=0 /code /code
RUN ["npm", "prune", "--production"]
FROM node:13
WORKDIR /code
COPY --from=0 /code /code
COPY tsconfig.json /code/tsconfig.json
COPY tslint.json /code/tslint.json
COPY src /code/src
RUN ["npm", "run", "test"]
RUN ["npm", "run", "build"]
FROM node:13
WORKDIR /code
COPY --from=1 /code /code
COPY --from=2 /code/dist /code/dist
ENTRYPOINT ["node", "/code/dist/index.js"]The idea is to cache as much as possible. Which is why all depenencies are installed first, which will be used for TypeScript build, then from the same dependencies non-production modules are pruned and then build artifact is deployed.
Currently pruning also causes mediasoup build to restart, which increases build time significantly and causes some other difficulties as well.
Maybe add some check that build was already finished or something like that?
UPD: This can be an improvement rather than a bug though.
Metadata
Metadata
Assignees
Labels
No labels
Activity
ibc commentedon Jun 8, 2020
I don't understand what this issue or feature request is about. mediasoup is a NPM library and, like any other, it's just installed (and hence compiled) when a new version is requested or available (based on SEMVER logic in
package.json).nazar-pc commentedon Jun 8, 2020
The issue is that it is compiled once on
npm ciand then once again ifnpm prune --productionis called after that.ibc commentedon Jun 9, 2020
I have no idea about why it's compiled twice following those steps. First time I know about
npm prunecommand. I just don't know about it and honestly don't have time to investigate it for now.nazar-pc commentedon Jun 13, 2020
Closing, seems to be an upstream issue in NPM itself