Skip to content

DTO 이름 변경 및 response select 추가 #13

DTO 이름 변경 및 response select 추가

DTO 이름 변경 및 response select 추가 #13

# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy container app to Azure Web App - dev-knu-ai-api
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v2
- name: access to secrets
run: |
echo "OPENAI_API_KEY=$OPENAI_API_KEY" >> .env
echo "OPENAI_API_MODEL=$OPENAI_API_MODEL" >> .env
echo "MONGO_DB_URL=$MONGO_DB_URL" >> .env
echo "MYSQL_DB_USERNAME=$MYSQL_DB_USERNAME" >> .env
echo "MYSQL_DB_PASSWORD=$MYSQL_DB_PASSWORD" >> .env
echo "MYSQL_DB_DATABASE=$MYSQL_DB_DATABASE" >> .env
echo "MYSQL_DB_HOST=$MYSQL_DB_HOST" >> .env
echo "MYSQL_DB_PORT=$MYSQL_DB_PORT" >> .env
echo "PORT=$PORT" >> .env
echo "COOKIE_SECRET=$COOKIE_SECRET" >> .env
echo "EMAIL_USER=$EMAIL_USER" >> .env
echo "EMAIL_PASS=$EMAIL_PASS" >> .env
echo "APP_NAME=$APP_NAME" >> .env
env:
OPENAI_API_KEY: ${{secrets.OPENAI_API_KEY}}
OPENAI_API_MODEL: ${{secrets.OPENAI_API_MODEL}}
MONGO_DB_URL: ${{secrets.MONGO_DB_URL}}
MYSQL_DB_USERNAME: ${{secrets.MYSQL_DB_USERNAME}}
MYSQL_DB_PASSWORD: ${{secrets.MYSQL_DB_PASSWORD}}
MYSQL_DB_DATABASE: ${{secrets.MYSQL_DB_DATABASE}}
MYSQL_DB_HOST: ${{secrets.MYSQL_DB_HOST}}
MYSQL_DB_PORT: ${{secrets.MYSQL_DB_PORT}}
PORT: ${{secrets.PORT}}
COOKIE_SECRET: ${{secrets.COOKIE_SECRET}}
EMAIL_USER: ${{secrets.EMAIL_USER}}
EMAIL_PASS: ${{secrets.EMAIL_PASS}}
APP_NAME: ${{secrets.APP_NAME}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to registry
uses: docker/login-action@v2
with:
registry: https://knuai.azurecr.io/
username: ${{ secrets.AzureAppService_ContainerUsername_2dc87649fd734304a6b4cb801ffab443 }}
password: ${{ secrets.AzureAppService_ContainerPassword_e3c6b2be8c9e481e99f77ed9fa269f5d }}
- name: Build and push container image to registry
uses: docker/build-push-action@v3
with:
push: true
tags: knuai.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_2dc87649fd734304a6b4cb801ffab443 }}/knuai:${{ github.sha }}
file: ./Dockerfile
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'dev-knu-ai-api'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_da1dbca6523e4081ad6e52bd11c3bce7 }}
images: 'knuai.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_2dc87649fd734304a6b4cb801ffab443 }}/knuai:${{ github.sha }}'