To run my project, I use the command docker-compose up --build -d
my container starts and stops immediately. In the container details I have this :
2023-03-09 12:50:46 questionnaire-front-survey_dev-1 | /bin/sh: ./env.sh: not found
I'm not sure if that's relevant but I have this in my dockerfile :
CMD ./env.sh > ./public/env.js && yarn start
And this is my env.sh file :
#!/bin/sh
# Add assignment
echo "window._ENV_ = {"
# Get all env variables
# Read each line in env
# Each line represents key=value pairs
printenv | grep REACT_APP* | while read -r line || [ -n "$line" ];
do
# Split env variables by character `=`
if printf '%s\n' "$line" | grep -q -e '='; then
varname=$(printf '%s\n' "$line" | sed -e 's/=.*//')
varvalue=$(printf '%s\n' "$line" | sed -e 's/^[^=]*=//')
fi
# Append configuration property to JS file
echo " $varname: \"$varvalue\","
done
echo "}"
I have no idea why I have this error.
Thank you!
I've checked, all my files are in CRLF. And I'm on windows.