Merge pull request #15 from se4ai2324-uniba/codecarbon #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 - ITdisambiguation | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: 'ubuntu-latest' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to registry | |
uses: docker/login-action@v2 | |
with: | |
registry: https://index.docker.io/v1/ | |
username: ${{ secrets.AzureAppService_ContainerUsername_56a097857ddb45fe8e6b314790a2e992 }} | |
password: ${{ secrets.AzureAppService_ContainerPassword_8e4122ab83264736b56be61c47bf80d4 }} | |
- name: Python setup | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: DVC setup | |
uses: iterative/setup-dvc@v1 | |
- name: Prepare data and model | |
env: | |
GDRIVE_CREDENTIALS_DATA: ${{ secrets.GDRIVE_CREDENTIALS_DATA }} | |
run: dvc pull models/model.pt | |
- name: Build the Docker image # push The image to the docker hub | |
run: docker build . --file ./src/Dockerfile --tag index.docker.io/${{ secrets.AzureAppService_ContainerUsername_56a097857ddb45fe8e6b314790a2e992 }}/itdisambiguation:${{ github.sha }} | |
- name: Docker Push | |
run: docker push index.docker.io/${{ secrets.AzureAppService_ContainerUsername_56a097857ddb45fe8e6b314790a2e992 }}/itdisambiguation:${{ github.sha }} | |
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: 'ITdisambiguation' | |
slot-name: 'production' | |
publish-profile: ${{ secrets.AzureAppService_PublishProfile_1e5ada4beceb41e49662c200d156da71 }} | |
images: 'index.docker.io/${{ secrets.AzureAppService_ContainerUsername_56a097857ddb45fe8e6b314790a2e992 }}/itdisambiguation:${{ github.sha }}' |