Skip to content

Commit

Permalink
Optimize node_modules cache for Platform.sh deployment (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
lchrusciel authored Jan 23, 2025
2 parents cc18f28 + 8f6806c commit ee7c7d1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .platform.app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ hooks:
build: |
set -x -e
# Restore node_modules from cache if available
if [ -d "$PLATFORM_CACHE_DIR/node_modules" ]; then
echo "Restoring node_modules from cache"
cp -R "$PLATFORM_CACHE_DIR/node_modules" tests/Application/
fi
wkhtmltopdf -V
curl -fs https://get.symfony.com/cloud/configurator | bash
Expand All @@ -22,8 +28,13 @@ hooks:
cd tests/Application
yarn install
yarn install --frozen-lockfile
yarn build:prod
# Cache node_modules for next build
echo "Caching node_modules directory"
rm -rf "$PLATFORM_CACHE_DIR/node_modules"
cp -R node_modules "$PLATFORM_CACHE_DIR/"
deploy: |
set -x -e
Expand Down Expand Up @@ -67,6 +78,7 @@ mounts:
"/tests/Application/public/assets": "shared:files/assets"
"/tests/Application/public/bundles": "shared:files/bundles"
"/tests/Application/private/credit_memos/": "shared:files/credit_memos"
"/tests/Application/node_modules/.cache": "shared:files/node_modules/.cache"

# The configuration of app when it is exposed to the web.
web:
Expand Down

0 comments on commit ee7c7d1

Please sign in to comment.