Skip to content

Commit

Permalink
use the port 8000 for container
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoavellanedat17 committed Jul 9, 2024
1 parent 6f56b29 commit 584d0fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ jobs:
# Build Docker image
sudo docker build -t fastapi-to-dos .
# Stop and remove previous Docker container (if running)
CONTAINER_ID=$(sudo docker ps -aqf "name=fastapi-to-dos")
if [ -n "$CONTAINER_ID" ]; then
sudo docker stop $CONTAINER_ID
sudo docker rm $CONTAINER_ID
fi
PORT_IN_USE=$(sudo lsof -t -i:8000)
if [ -n "$PORT_IN_USE" ]; then
sudo kill -9 $PORT_IN_USE
fi
# Run new Docker container
sudo docker run -p 8000:8000 fastapi-to-dos --restart unless-stopped fastapi-to-dos
sudo docker run -d -p 8000:8000 --name fastapi-to-dos --restart unless-stopped fastapi-to-dos
EOF

0 comments on commit 584d0fc

Please sign in to comment.