Azure web app nestjs cannot use shell scripts as startup command
I have a simple nestjs application deployed in azure web app. I also have a simple shell script that does the following:
# !/bin/sh
npm ci
node main.js
I am using github actions to build the nestjs project and copy package.json, package-lock.json and other files and deploy them to azure.
github actions:
name: Build and deploy Nest.js app to Azure Web App
on:
push:
branches:
- dev
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Node.js version
uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: npm install, build, and test
uses: actions/setup-node@v1
with:
node-version: "16.x"
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm run test --if-present
- name: copy package.json and package-lock.json
uses: actions/setup-node@v1
- run: cp ./package.json ./dist/
- run: cp ./package-lock.json ./dist/
- run: cp ./deploy.sh ./dist/
- run: cd ./dist/ && ls
- name: Zip all files for upload between jobs
run: zip --symlinks -r nest.zip ./dist/*
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
with:
name: ${{ secrets.DEV_AZURE_APP_API_NAME }}
path: nest.zip
- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: ${{ secrets.DEV_AZURE_APP_API_NAME }}
publish-profile: ${{ secrets.DEV_AZURE_PUBLISH_PROFILE_API }}
package: nest.zip
- name: Delete zip file
run: rm nest.zip
my startup command: ./dist/deploy.sh
The issue I see is that deploy.sh file copied from github actions is not available after being unzipped by azure web apps.
The reason for going for a shell script for nestjs is because zipping node_modules causes our deployment to take around 10 minutes because our zip file is about 70mb in size.