awacke1 commited on
Commit
3545a4b
β€’
1 Parent(s): 8b01da1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +76 -2
app.py CHANGED
@@ -2,7 +2,81 @@ import streamlit as st
2
 
3
 
4
  st.markdown("""
5
- https://github.com/AaronCWacker/Yggdrasil/tree/main
6
 
7
- https://github.com/AaronCWacker/Docker-ACA-Examples
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  """)
 
2
 
3
 
4
  st.markdown("""
 
5
 
6
+ Streamlit: https://huggingface.co/spaces/DockerTemplates/streamlit-docker-example
7
+ Gradio: https://huggingface.co/spaces/sayakpaul/demo-docker-gradio
8
+ HTTP w GO: https://huggingface.co/spaces/XciD/test-docker-go?q=Adrien
9
+ Secrets: https://huggingface.co/spaces/DockerTemplates/secret-example
10
+ Fast API: https://huggingface.co/spaces/DockerTemplates/fastapi_t5
11
+
12
+ # Github Actions Deploy to ACA:
13
+
14
+ πŸ‹ Create a Dockerfile for Gradio deployment πŸ‹
15
+
16
+ 1️⃣ Start by specifying the base image for your container. For Python:
17
+
18
+ FROM python:3.8-slim-buster
19
+
20
+ 2️⃣ Set the working directory for the container and copy the necessary files:
21
+
22
+ WORKDIR /app
23
+ COPY . /app
24
+
25
+ 3️⃣ Install the necessary dependencies, including Gradio:
26
+
27
+ RUN pip install --upgrade pip && \
28
+ pip install gradio
29
+
30
+ 4️⃣ Specify the command to run when the container starts:
31
+
32
+ CMD ["python", "app.py"]
33
+
34
+ :rocket: Build and push your container image to Azure Container Registry :rocket:
35
+
36
+ :green_book: Set up a GitHub Actions workflow for deployment :green_book:
37
+
38
+ Use azure/login action for Azure authentication and azure/container-apps-deploy-action for deployment. Provide necessary inputs like container app name, Azure Container Registry name, and container image tag.
39
+
40
+ Here's an example GitHub Actions workflow:
41
+ name: Deploy to Azure Container Apps
42
+
43
+ on: push: branches: - main
44
+
45
+ env: AZURE_CONTAINER_APP_NAME: AZURE_CONTAINER_REGISTRY_NAME: IMAGE_TAG: ${{ github.sha }}
46
+
47
+ jobs: deploy: runs-on: ubuntu-latest steps: - name: Check out code uses: actions/checkout@v2
48
+
49
+ - name: Login to Azure
50
+ uses: azure/login@v1
51
+ with:
52
+ creds: ${{ secrets.AZURE_CREDENTIALS }}
53
+
54
+ - name: Deploy to Azure Container Apps
55
+ uses: azure/container-apps-deploy-action@v1
56
+ with:
57
+ containerAppName: ${{ env.AZURE_CONTAINER_APP_NAME }}
58
+ imageName: ${{ env.AZURE_CONTAINER_REGISTRY_NAME }}.azurecr.io/myimage:${{ env.IMAGE_TAG }}
59
+
60
+ :arrow_forward: **After your GitHub Actions workflow is set up, follow these steps to get your app running on Azure Container Apps** :arrow_forward:
61
+
62
+ 5️⃣ **Commit and push your changes** :file_folder:
63
+
64
+ Once you've made all necessary changes to your Dockerfile and GitHub Actions workflow file, commit and push them to your repository.
65
+
66
+ ```bash
67
+ git add .
68
+ git commit -m "Setup Dockerfile and GitHub Actions workflow"
69
+ git push origin main
70
+ 6️⃣ Watch your GitHub Actions workflow πŸ‘€
71
+
72
+ Go to the "Actions" tab in your GitHub repository to see your workflow in action. If everything is set up correctly, you should see your workflow running and completing without errors.
73
+
74
+ 7️⃣ Check your app on Azure Container Apps 🏁
75
+
76
+ Once the GitHub Actions workflow has completed, your app should be deployed to Azure Container Apps. You can check the status of your app in the Azure portal.
77
+
78
+ 8️⃣ Enjoy your Gradio app running smoothly on Azure Container Apps πŸŽ‰
79
+
80
+ You've successfully deployed your Gradio app to Azure Container Apps using a Docker container and GitHub Actions!
81
+
82
  """)