Merge pull request #18570 from overleaf/jpa-lean-npm-install

[server-ce] omit devDependencies from final image

GitOrigin-RevId: e35d7010ee33345121fb175e0400be122cb468c1
This commit is contained in:
Jakob Ackermann 2024-05-30 10:43:40 +02:00 committed by Copybot
parent f5701b67eb
commit 2f5bcebcdd
2 changed files with 9 additions and 2 deletions

View file

@ -21,7 +21,6 @@ ADD patches/ /overleaf/patches
# Install npm dependencies # Install npm dependencies
# ------------------------ # ------------------------
ENV CYPRESS_INSTALL_BINARY=0
RUN node genScript install | bash RUN node genScript install | bash
# Compile # Compile

View file

@ -5,16 +5,24 @@ console.log('set -ex')
switch (process.argv.pop()) { switch (process.argv.pop()) {
case 'install': case 'install':
console.log('npm ci') console.log('npm install --omit=dev')
break break
case 'compile': case 'compile':
for (const service of services) { for (const service of services) {
console.log('pushd', `services/${service.name}`) console.log('pushd', `services/${service.name}`)
switch (service.name) { switch (service.name) {
case 'web': case 'web':
// Avoid downloading of cypress
console.log('export CYPRESS_INSTALL_BINARY=0')
// install webpack and frontend dependencies
console.log('npm install --include=dev')
// run webpack
console.log('npm run webpack:production') console.log('npm run webpack:production')
// drop webpack/babel cache // drop webpack/babel cache
console.log('rm -rf node_modules/.cache') console.log('rm -rf node_modules/.cache')
// uninstall webpack and frontend dependencies
console.log('npm install --omit=dev')
break break
default: default:
console.log(`echo ${service.name} does not require a compilation`) console.log(`echo ${service.name} does not require a compilation`)