I tried deploying a simple web app with Go as the backend and React as the frontend. When I deploy my React app to Azure Web App using GitHub, I get the same error.
it is saying that the container didn't respond to pings on port 8080.
To resolve the above, I used below Startup Command
in the Configuration section of my Azure Web App.
pm2 serve /home/site/wwwroot/build --no-daemon --spa
Make Sure to Enable Access-Control-Credentials
for Frontend URL in CORS section of Azure Web App.
GitHub Workflow File:
name: Build and deploy Node.js app to Azure Web App - kareactwebapp
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: npm install, build
run: |
npm install
npm run build --if-present
- name: Zip artifact for deployment
run: zip release.zip ./* -r
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: node-app
path: release.zip
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write #This is required for requesting the JWT
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: node-app
- name: Unzip artifact for deployment
run: unzip release.zip
- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_2E3A719386B34C329432070E0CBA706E }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_4AB5B4332AA14B8DA4D29611B84DCC23 }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_3B6FC06574EB489CA89ADD342F031641 }}
- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: 'kareactwebapp'
slot-name: 'Production'
package: .
Azure Output: