From 01d7a837f8c487d2af3fe33368534b8b81158439 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Tue, 9 Sep 2025 01:18:28 +0200 Subject: [PATCH] refactor: streamline Docker Compose configuration and remove unnecessary build steps --- .gitea/workflows/deploy.yml | 19 ++++++++----------- compose.prod.yml | 12 ++---------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 8d5e4e7..90f66d0 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -14,11 +14,6 @@ jobs: - name: Checkout Code uses: actions/checkout@v3 - - name: Check Docker Versions - run: | - docker --version - docker compose version - - name: Create .env file run: | echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> .env @@ -27,12 +22,14 @@ jobs: echo "AUTH_SECRET=${{ secrets.AUTH_SECRET }}" >> .env echo "NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL }}" >> .env - - name: Rebuild and Deploy with Docker Compose - env: - DOCKER_BUILDKIT: 1 + - name: Build Docker Images Manually run: | - docker compose -f compose.prod.yml pull - docker compose -f compose.prod.yml up -d --build + docker build --target runtime -t thoughts-backend:latest ./thoughts-backend + docker build --target release -t thoughts-frontend:latest --build-arg NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL }} ./thoughts-frontend + + - name: Deploy with Docker Compose + run: | + # Use "up" without --build, as images are already built + docker compose -f compose.prod.yml up -d - # Clean up any old, unused images to save disk space docker image prune -f \ No newline at end of file diff --git a/compose.prod.yml b/compose.prod.yml index 4f9c743..017323f 100644 --- a/compose.prod.yml +++ b/compose.prod.yml @@ -19,10 +19,7 @@ services: backend: container_name: thoughts-backend - build: - context: ./thoughts-backend - dockerfile: Dockerfile - target: runtime + image: thoughts-backend:latest restart: unless-stopped environment: - RUST_LOG=info @@ -41,12 +38,7 @@ services: frontend: container_name: thoughts-frontend - build: - context: ./thoughts-frontend - dockerfile: Dockerfile - target: release - args: - NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL} + image: thoughts-frontend:latest restart: unless-stopped depends_on: - backend