fix(ci): stop & remove old container before deploying new one
CI/CD / CI · dotnet build (push) Successful in 24s
CI/CD / Deploy · drsousan (push) Successful in 12s

docker compose up --force-recreate only works when Compose owns the
container. If the container was started outside Compose (e.g. manually
via docker restart), Compose can't recreate it and errors with
"container name already in use". Explicitly stopping and removing it
first handles both cases cleanly.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-02 01:59:16 +03:30
parent dd5afde5df
commit e4ad440c15
+4 -1
View File
@@ -91,7 +91,10 @@ jobs:
DOCKER_BUILDKIT: 1 DOCKER_BUILDKIT: 1
- name: Deploy - name: Deploy
run: docker compose up -d --no-deps --force-recreate api run: |
docker stop drsousan_api 2>/dev/null || true
docker rm drsousan_api 2>/dev/null || true
docker compose up -d --no-deps api
- name: Wait for healthy - name: Wait for healthy
run: | run: |