oktopus/frontend/build/entrypoint.sh
2024-04-09 01:04:58 -03:00

18 lines
546 B
Bash

#!/usr/bin/env sh
set -Ex
function apply_path {
echo "Check that we have NEXT_PUBLIC_REST_ENPOINT vars"
test -n "$NEXT_PUBLIC_REST_ENPOINT"
echo "Check that we have NEXT_PUBLIC_WS_ENPOINT vars"
test -n "$NEXT_PUBLIC_WS_ENPOINT"
find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#REST_API_URL#$NEXT_PUBLIC_REST_ENPOINT#g"
find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#WS_URL#$ENVIROMENT_VAR#g"
}
apply_path
echo "Starting Nextjs"
exec "$@"