Feature/32 deploy api as azure function app (#34)

* changing api to azure function app

* changing api to azure function app

* changing api to azure function app

* changing api to azure function app

* changing api to azure function app

* changing api to azure function app

* changing api to azure container app
This commit was merged in pull request #34.
This commit is contained in:
2024-11-30 04:51:16 +00:00
committed by GitHub
parent f70e8cce2a
commit cd21f5170f
17 changed files with 395 additions and 207 deletions

62
.github/workflows/api.yaml vendored Normal file
View File

@@ -0,0 +1,62 @@
name: 'API Build and Deploy'
on:
workflow_call:
inputs:
calling_workflow:
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
environment: ${{ inputs.calling_workflow }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: 'Setup Node'
uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODE_VERSION }}
- name: Install
run: |
npm install
- name: Build
shell: bash
run: |
npm run build -w api
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push to registry
uses: docker/build-push-action@v6
with:
push: true
tags: noahspan/flying-api:${{ github.run_id }}
file: ./api/Dockerfile
context: ./api
deploy:
runs-on: ubuntu-latest
environment: ${{ inputs.calling_workflow }}
needs: build
steps:
- name: Log in to Azure
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Update Container App
run: |
az container app update --name flying-api --resource-group noahspan --image noahspan-flying:${{ github.run_id }}