From 07cf999a9e4e2aee8a451b0d316c449cd4486b2f Mon Sep 17 00:00:00 2001 From: denshooter Date: Wed, 10 Sep 2025 12:01:56 +0200 Subject: [PATCH] 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 --- .github/workflows/ci-cd.yml | 7 +++++-- docker-compose.prod.yml | 4 +--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 1c4cf00..5f0c7da 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -190,8 +190,11 @@ jobs: # Stop and remove old container docker compose -f $COMPOSE_FILE down || true - # Start new container - docker compose -f $COMPOSE_FILE up -d + # Remove old images to force using new one + docker image prune -f + + # Start new container with force recreate + docker compose -f $COMPOSE_FILE up -d --force-recreate # Wait for health check echo "Waiting for application to be healthy..." diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 9e8454b..cd415ae 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,8 +1,6 @@ services: portfolio: - build: - context: . - dockerfile: Dockerfile + image: ghcr.io/denshooter/my_portfolio:production container_name: portfolio-app restart: unless-stopped ports: