Skip to content

Commit 7b31efd

Browse files
committed
fix
1 parent 279116f commit 7b31efd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.github/workflows/build-and-run.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,11 @@ jobs:
1414
- uses: actions/checkout@v4
1515
- name: Build the Docker image
1616
run: sudo docker build -t backend .
17+
- name: Stop and remove existing container if it exists
18+
run: |
19+
if [ "$(sudo docker ps -aq -f name=backend)" ]; then
20+
sudo docker stop backend
21+
sudo docker rm backend
22+
fi
1723
- name: Run the Docker container on port 8000
18-
run: sudo docker stop backend && sudo docker run -d -p 8000:8000 backend
24+
run: sudo docker run -d -p 8000:8000 backend

0 commit comments

Comments
 (0)