diff --git a/.github/workflows/backend-prod.yml b/.github/workflows/backend-prod.yml index 5ea6bb97..a367d5c8 100644 --- a/.github/workflows/backend-prod.yml +++ b/.github/workflows/backend-prod.yml @@ -132,6 +132,25 @@ jobs: echo "Nginx container started." fi + # Ensure nginx-conf directory exists + if [ ! -d ./nginx-conf ]; then + echo "Creating nginx-conf directory..." + mkdir -p ./nginx-conf + fi + + # Ensure default.conf file exists + if [ ! -f ./nginx-conf/default.conf ]; then + echo "Creating default.conf file..." + echo " + server { + listen 80; + location / { + proxy_pass http://127.0.0.1:${{ steps.check-port.outputs.next_port }}; + } + } + " > ./nginx-conf/default.conf + fi + # Update Nginx configuration file on host echo "Updating Nginx configuration file on host..." sudo sed -i "s/proxy_pass http:\/\/127.0.0.1:.*;/proxy_pass http:\/\/127.0.0.1:${{ steps.check-port.outputs.next_port }};/" ./nginx-conf/default.conf