Fix Docker deployment - use built image instead of building locally
- Change docker-compose.prod.yml to use ghcr.io image instead of building - Add --force-recreate flag to ensure new container is created - Add docker image prune to remove old images - This should fix the issue where old container version is served
This commit is contained in:
7
.github/workflows/ci-cd.yml
vendored
7
.github/workflows/ci-cd.yml
vendored
@@ -190,8 +190,11 @@ jobs:
|
|||||||
# Stop and remove old container
|
# Stop and remove old container
|
||||||
docker compose -f $COMPOSE_FILE down || true
|
docker compose -f $COMPOSE_FILE down || true
|
||||||
|
|
||||||
# Start new container
|
# Remove old images to force using new one
|
||||||
docker compose -f $COMPOSE_FILE up -d
|
docker image prune -f
|
||||||
|
|
||||||
|
# Start new container with force recreate
|
||||||
|
docker compose -f $COMPOSE_FILE up -d --force-recreate
|
||||||
|
|
||||||
# Wait for health check
|
# Wait for health check
|
||||||
echo "Waiting for application to be healthy..."
|
echo "Waiting for application to be healthy..."
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
portfolio:
|
portfolio:
|
||||||
build:
|
image: ghcr.io/denshooter/my_portfolio:production
|
||||||
context: .
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
container_name: portfolio-app
|
container_name: portfolio-app
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
Reference in New Issue
Block a user