File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- name : Docker Image CI
1+ name : Docker Image CI with ngrok for Streamlit
22
33on :
44 push :
77 branches : [ "main" ]
88
99jobs :
10-
11- build :
12-
10+ build-and-expose :
1311 runs-on : ubuntu-latest
1412
1513 steps :
16- - uses : actions/checkout@v4
14+ - name : Checkout code
15+ uses : actions/checkout@v4
16+
17+ - name : Set image tag
18+ run : echo "IMAGE_TAG=chatbot:$(date +%s)" >> $GITHUB_ENV
1719
18- - name : Build the Docker image
20+ - name : Build Docker image
21+ run : docker build . --file Dockerfile --tag ${{ env.IMAGE_TAG }}
22+
23+ - name : Run Docker container
24+ run : docker run -d -p 8501:8501 --name chatbot ${{ env.IMAGE_TAG }}
25+
26+ - name : Install ngrok
1927 run : |
20- IMAGE_TAG=chatbot:$(date +%s)
21- echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
22- docker build . --file Dockerfile --tag $IMAGE_TAG
28+ curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null
29+ echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list
30+ sudo apt update && sudo apt install ngrok
2331
24- - name : Run the Docker container
25- run : docker run ${{ env.IMAGE_TAG }}
32+ - name : Start ngrok tunnel to Streamlit
33+ env :
34+ NGROK_AUTHTOKEN : ${{ secrets.NGROK_AUTHTOKEN }}
35+ run : |
36+ ngrok config add-authtoken $NGROK_AUTHTOKEN
37+ nohup ngrok http 8501 > ngrok.log &
38+ sleep 5
39+ echo "🔗 Public URL:"
40+ curl -s http://127.0.0.1:4040/api/tunnels | jq -r '.tunnels[0].public_url'
You can’t perform that action at this time.
0 commit comments