sudo -u deploy bash -lc 'cd /opt/myapp && npm ci --omit=dev && npm run build'
Install deps and build as the deploy user
Runs the install-and-build pipeline as the deploy user via sudo -u, with bash -lc giving it a login shell so PATH and nvm settings apply. The single-quoted chain does a clean npm ci, then npm run build for compiled frontends. Building as a non-root user keeps the artifacts owned by deploy, not root.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.