This commit is contained in:
54
.gitea/workflows/deploy.yaml
Normal file
54
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,54 @@
|
||||
name: Docker Deploy
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
docker build -t my-jiodown-app:latest .
|
||||
|
||||
# - name: Remove Old Container
|
||||
# run: |
|
||||
# # Use '|| true' to force a success exit code even if the container is missing
|
||||
# docker stop my-running-app || true
|
||||
# docker rm my-running-app || true
|
||||
- name: Remove Old Container and Free Port
|
||||
run: |
|
||||
# 1. Stop and remove by NAME (what we had before)
|
||||
docker stop my-jiodown-app || true
|
||||
docker rm my-jiodown-app || true
|
||||
|
||||
# 2. EMERGENCY: Stop any container actually using port 9002
|
||||
# This finds the ID of any container bound to 9002 and kills it
|
||||
PORT_OWNER=$(docker ps -q --filter "publish=8501")
|
||||
if [ ! -z "$PORT_OWNER" ]; then
|
||||
docker stop $PORT_OWNER
|
||||
docker rm $PORT_OWNER
|
||||
fi
|
||||
|
||||
- name: Start New Container
|
||||
run: |
|
||||
docker run -d \
|
||||
--name my-jiodown-app \
|
||||
-p 8501:8501 \
|
||||
-v /path/on/your/host:/usr/share/nginx/html \
|
||||
--restart unless-stopped \
|
||||
Jiodown:latest
|
||||
|
||||
# - name: Deploy to CasaOS (Docker)
|
||||
# run: |
|
||||
# # Stop and remove the old container if it exists
|
||||
# docker stop my-running-app || true
|
||||
# docker rm my-running-app || true
|
||||
|
||||
# # Run the new container
|
||||
# docker run -d \
|
||||
# --name my-running-app \
|
||||
# -p 9002:5005 \
|
||||
# --restart always \
|
||||
# my-local-app:latest
|
||||
Reference in New Issue
Block a user