This commit is contained in:
@@ -12,11 +12,24 @@ jobs:
|
||||
run: |
|
||||
docker build -t my-local-app:latest .
|
||||
|
||||
- name: Remove Old Container
|
||||
# - 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: |
|
||||
# Use '|| true' to force a success exit code even if the container is missing
|
||||
# 1. Stop and remove by NAME (what we had before)
|
||||
docker stop my-running-app || true
|
||||
docker rm my-running-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=9002")
|
||||
if [ ! -z "$PORT_OWNER" ]; then
|
||||
docker stop $PORT_OWNER
|
||||
docker rm $PORT_OWNER
|
||||
fi
|
||||
|
||||
- name: Start New Container
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user