docker: run npm ci and vendor asset setup at build time
Build and Deploy (dev) / build (push) Successful in 5m9s
Build and Deploy (dev) / build (push) Successful in 5m9s
- npm ci in a cached layer (package.json/lock only), setup-vendor.js after copying the app - Entrypoint only installs/copies when node_modules/ or public/assets/vendor is missing or empty (e.g. hidden by a volume) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2ddcb1b6b0
commit
66f13a3953
2 files changed
+17
-5
No files matched your search
@@ -25,10 +25,14 @@ if [ ! -f vendor/autoload.php ]; then
|
||||
--optimize-autoloader
|
||||
fi
|
||||
|
||||
# Install npm dependencies if package.json has dependencies
|
||||
if grep -q "\"dependencies\"" package.json; then
|
||||
echo "Installing npm packages..."
|
||||
npm ci --omit=dev
|
||||
# npm packages and public/assets/vendor are also built into the image. Only
|
||||
# (re)create them here as a fallback, e.g. when they are hidden by a volume.
|
||||
if [ ! -d node_modules ]; then
|
||||
echo "node_modules/ missing, installing npm packages..."
|
||||
npm ci --omit=dev --ignore-scripts
|
||||
node scripts/setup-vendor.js
|
||||
elif [ -z "$(ls -A public/assets/vendor 2>/dev/null)" ]; then
|
||||
echo "public/assets/vendor is empty, copying npm packages..."
|
||||
node scripts/setup-vendor.js
|
||||
fi
|
||||
|
||||
|
||||
Reference in new issue
Block a user