refactor: streamline Docker Compose configuration and remove unnecessary build steps
Some checks failed
Build and Deploy Thoughts / build-and-deploy-local (push) Failing after 6s

This commit is contained in:
2025-09-09 01:18:28 +02:00
parent 71048f0060
commit 01d7a837f8
2 changed files with 10 additions and 21 deletions

View File

@@ -14,11 +14,6 @@ jobs:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Check Docker Versions
run: |
docker --version
docker compose version
- name: Create .env file - name: Create .env file
run: | run: |
echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> .env echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> .env
@@ -27,12 +22,14 @@ jobs:
echo "AUTH_SECRET=${{ secrets.AUTH_SECRET }}" >> .env echo "AUTH_SECRET=${{ secrets.AUTH_SECRET }}" >> .env
echo "NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL }}" >> .env echo "NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL }}" >> .env
- name: Rebuild and Deploy with Docker Compose - name: Build Docker Images Manually
env:
DOCKER_BUILDKIT: 1
run: | run: |
docker compose -f compose.prod.yml pull docker build --target runtime -t thoughts-backend:latest ./thoughts-backend
docker compose -f compose.prod.yml up -d --build 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 docker image prune -f

View File

@@ -19,10 +19,7 @@ services:
backend: backend:
container_name: thoughts-backend container_name: thoughts-backend
build: image: thoughts-backend:latest
context: ./thoughts-backend
dockerfile: Dockerfile
target: runtime
restart: unless-stopped restart: unless-stopped
environment: environment:
- RUST_LOG=info - RUST_LOG=info
@@ -41,12 +38,7 @@ services:
frontend: frontend:
container_name: thoughts-frontend container_name: thoughts-frontend
build: image: thoughts-frontend:latest
context: ./thoughts-frontend
dockerfile: Dockerfile
target: release
args:
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL}
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
- backend - backend