-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (53 loc) · 1.64 KB
/
Copy pathdocker-image.yml
File metadata and controls
65 lines (53 loc) · 1.64 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
name: docker image CI
on:
push:
branches:
- main
paths-ignore:
- 'infra/**/*'
- 'hack/**/*'
- 'docs/**/*'
- 'clients/**/*'
- 'build/**/*'
- '*.md'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for proper change detection
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build and Deploy
run: |
# Get the list of changed files
CHANGED_FILES=$(git diff --name-only HEAD^ HEAD)
# Function to build Docker image
build_image() {
local service=$1
local dir=$2
echo "Building $service..."
cd $dir
docker build -t $service:$(date +%s) .
cd ../..
}
# Check each service directory for changes
if echo "$CHANGED_FILES" | grep -q "^persys-gateway/"; then
build_image "persys-gateway" "persys-gateway"
fi
if echo "$CHANGED_FILES" | grep -q "^persys-scheduler/"; then
build_image "persys-scheduler" "persys-scheduler"
fi
if echo "$CHANGED_FILES" | grep -q "^persys-federation/"; then
build_image "persys-federation" "persys-federation"
fi
if echo "$CHANGED_FILES" | grep -q "^persys-forgery/"; then
build_image "persys-forgery" "persys-forgery"
fi
if echo "$CHANGED_FILES" | grep -q "^compute-agent/"; then
build_image "compute-agent" "compute-agent"
fi
- name: List built images
run: docker images