-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add entrypoint script that dynamically sets vue args post-build in do…
…cker prod containers
- Loading branch information
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
# Patch the built app to use the specified environment variables | ||
# at runtime, then serve the app | ||
# | ||
# See https://stackoverflow.com/questions/53010064/pass-environment-variable-into-a-vue-app-at-runtime for inspiration. | ||
# | ||
set -e | ||
ROOT_DIR=/app/dist | ||
|
||
echo "Replacing env vars in Javascript files" | ||
for file in $ROOT_DIR/js/app.*.js*; do | ||
echo "Patching $file" | ||
sed -i "s|magic-api-url|${VUE_APP_API_URL}|g" $file | ||
sed -i "s|magic-logo-url|${VUE_APP_LOGO_URL}|g" $file | ||
sed -i "s|magic-homepage-url|${VUE_APP_HOMEPAGE_URL}|g" $file | ||
done | ||
|
||
serve -s ${ROOT_DIR} -p 8081 |