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
+9
-1
@@ -56,7 +56,12 @@ RUN composer install \
|
||||
--no-scripts \
|
||||
--no-autoloader
|
||||
|
||||
# Copy app files (npm setup happens at runtime via entrypoint)
|
||||
# Install npm dependencies (cached layer, only rebuilt when package.json/lock change).
|
||||
# The postinstall script is skipped here; the assets are copied after the app code below.
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci --omit=dev --ignore-scripts
|
||||
|
||||
# Copy app files
|
||||
COPY . .
|
||||
|
||||
# Create storage directories
|
||||
@@ -72,6 +77,9 @@ RUN mkdir -p \
|
||||
# Generate the optimized autoloader and run composer scripts (package:discover)
|
||||
RUN composer dump-autoload --no-dev --optimize --no-interaction
|
||||
|
||||
# Copy the npm packages into public/assets/vendor
|
||||
RUN node scripts/setup-vendor.js
|
||||
|
||||
# Copy and set up entrypoint script
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
Reference in new issue
Block a user