-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (71 loc) · 2.06 KB
/
docker-build.yml
File metadata and controls
90 lines (71 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Docker Build CI
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master ]
jobs:
build-web:
name: Build Frontend (Web)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Web Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: ./packages/web/Dockerfile
push: false
tags: digiverse/web:latest
cache-from: type=gha
cache-to: type=gha,mode=max
build-backend:
name: Build Backend (API)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Backend Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: ./packages/backend/Dockerfile
push: false
tags: digiverse/backend:latest
cache-from: type=gha
cache-to: type=gha,mode=max
test-docker-compose:
name: Test Docker Compose Setup
runs-on: ubuntu-latest
needs: [build-web, build-backend]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create .env file
run: cp .env.example .env
- name: Build with Docker Compose
run: docker-compose build
- name: Start services
run: docker-compose up -d
- name: Wait for services to be healthy
run: |
echo "Waiting for services to start..."
sleep 30
docker-compose ps
- name: Check Web health
run: |
curl -f http://localhost/health || exit 1
- name: Check Backend health
run: |
curl -f http://localhost:3000/health || exit 1
- name: Show logs on failure
if: failure()
run: docker-compose logs
- name: Cleanup
if: always()
run: docker-compose down -v