1
0
mirror of synced 2026-01-06 06:02:35 -05:00
Files
docs/.github/actions-scripts/prune-for-preview-env.sh
Mike Surowiec 59b53a9300 Improve docker build (#24692)
* better caching, reduce context size, etc
2022-02-02 21:05:20 +00:00

25 lines
913 B
Bash
Executable File

#!/usr/bin/env bash
# [start-readme]
#
# This script removes files that are unnecessary for our preview environments.
# This is typically run before a docker build to reduce the size of the build context sent to docker
#
# [end-readme]
# Remove all but the english search indexes
find lib/search/indexes ! -name '*-en.json.br' ! -name '*-en-records.json.br' -maxdepth 1 -type f -delete
# Translations are never tested in preview environments
# but let's keep the empty directory.
rm -rf translations
mkdir translations
# The assumption here is that a preview build will not
# need these legacy redirects. Only the redirects from
# front-matter will be at play.
# These static redirects json files are notoriously large
echo '[]' > lib/redirects/static/archived-frontmatter-fallbacks.json
echo '{}' > lib/redirects/static/developer.json
echo '{}' > lib/redirects/static/archived-redirects-from-213-to-217.json