Files
labFusion/.gitea/workflows/docker-build.yml
GSRN 7bb753e293
Some checks failed
API Docs (Node.js Express) / test (20) (push) Failing after 1m49s
API Docs (Node.js Express) / build (push) Has been skipped
API Gateway (Java Spring Boot) / test (17) (push) Failing after 3m18s
Docker Build and Push / setup (push) Successful in 10s
API Gateway (Java Spring Boot) / test (21) (push) Successful in 1m56s
API Gateway (Java Spring Boot) / build (push) Has been skipped
Docker Build and Push / build-push-service-adapters (push) Failing after 29s
Docker Build and Push / build-push-api-gateway (push) Failing after 32s
Docker Build and Push / build-push-api-docs (push) Failing after 31s
Docker Build and Push / build-push-frontend (push) Failing after 28s
Docker Build and Push / test-compatibility (push) Has been skipped
Integration Tests / integration-tests (push) Failing after 2m47s
Integration Tests / performance-tests (push) Has been skipped
chore: Update Docker configuration and documentation
### Summary of Changes
- Enhanced `docker-compose` files to include BuildKit compatibility settings for improved caching during builds.
- Updated service definitions to use pre-built images from the specified Docker registry, ensuring consistency across environments.
- Added Docker registry configuration to the `.env` example file for clarity on deployment settings.
- Revised the `README.md` to include instructions for using pre-built images and local development setups, along with Docker compatibility troubleshooting steps.
- Introduced health checks in the `Dockerfile` for the API Docs service to ensure container readiness.

### Expected Results
- Improved build performance and deployment clarity, facilitating easier setup for new developers and enhancing overall project maintainability.
2025-09-18 00:28:21 +02:00

235 lines
7.6 KiB
YAML

name: Docker Build and Push
on:
push:
branches: [ main, develop ]
tags: [ 'v*' ]
pull_request:
branches: [ main, develop ]
env:
REGISTRY: gittea.kammenstraatha.duckdns.org
REGISTRY_URL: https://gittea.kammenstraatha.duckdns.org
REPO_OWNER: admin
IMAGE_PREFIX: labfusion
jobs:
# Shared setup job for common steps
setup:
runs-on: self-hosted
outputs:
version: ${{ steps.meta.outputs.version }}
labels: ${{ steps.meta.outputs.labels }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/api-gateway
${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/service-adapters
${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/api-docs
${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/frontend
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
# API Gateway build and push
build-push-api-gateway:
runs-on: self-hosted
needs: setup
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push API Gateway (Legacy Builder)
uses: docker/build-push-action@v5
with:
context: ./services/api-gateway
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/api-gateway:${{ needs.setup.outputs.version }}
labels: ${{ needs.setup.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/api-gateway:cache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/api-gateway:cache,mode=max
# Use legacy builder for maximum compatibility
builder: default
build-args: |
BUILDKIT_INLINE_CACHE=0
# Service Adapters build and push
build-push-service-adapters:
runs-on: self-hosted
needs: setup
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push Service Adapters (Legacy Builder)
uses: docker/build-push-action@v5
with:
context: ./services/service-adapters
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/service-adapters:${{ needs.setup.outputs.version }}
labels: ${{ needs.setup.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/service-adapters:cache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/service-adapters:cache,mode=max
# Use legacy builder for maximum compatibility
builder: default
build-args: |
BUILDKIT_INLINE_CACHE=0
# API Docs build and push
build-push-api-docs:
runs-on: self-hosted
needs: setup
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push API Docs (Legacy Builder)
uses: docker/build-push-action@v5
with:
context: ./services/api-docs
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/api-docs:${{ needs.setup.outputs.version }}
labels: ${{ needs.setup.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/api-docs:cache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/api-docs:cache,mode=max
# Use legacy builder for maximum compatibility
builder: default
build-args: |
BUILDKIT_INLINE_CACHE=0
# Frontend build and push
build-push-frontend:
runs-on: self-hosted
needs: setup
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push Frontend (Legacy Builder)
uses: docker/build-push-action@v5
with:
context: ./frontend
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/frontend:${{ needs.setup.outputs.version }}
labels: ${{ needs.setup.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/frontend:cache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/frontend:cache,mode=max
# Use legacy builder for maximum compatibility
builder: default
build-args: |
BUILDKIT_INLINE_CACHE=0
# Compatibility test job
test-compatibility:
runs-on: self-hosted
needs: [build-push-api-gateway, build-push-service-adapters, build-push-api-docs, build-push-frontend]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Test API Docs compatibility
run: |
echo "Testing API Docs image compatibility..."
# Pull the latest image
docker pull ${{ env.REGISTRY }}/admin/api-docs:${{ needs.setup.outputs.version }}
# Test running the container
docker run --rm -d --name test-api-docs \
-p 8083:8083 \
${{ env.REGISTRY }}/admin/api-docs:${{ needs.setup.outputs.version }}
# Wait for container to start
sleep 10
# Check if container is running
if docker ps | grep -q test-api-docs; then
echo "✓ API Docs container started successfully"
else
echo "✗ API Docs container failed to start"
docker logs test-api-docs
exit 1
fi
# Clean up
docker stop test-api-docs || true
- name: Test docker-compose compatibility
run: |
echo "Testing docker-compose configuration..."
# Validate docker-compose.yml
docker-compose config > /dev/null
if [ $? -eq 0 ]; then
echo "✓ docker-compose.yml is valid"
else
echo "✗ docker-compose.yml has syntax errors"
exit 1
fi
- name: Compatibility test completed
run: |
echo "✓ All compatibility tests passed"
echo "Images are ready for deployment with maximum Docker version compatibility"