Skip to content

Commit 64ef2ab

Browse files
authored
Update docker-image.yml
1 parent 844d4de commit 64ef2ab

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

.github/workflows/docker-image.yml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@ name: Build and Push Docker Images
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches: [main]
76
release:
87
types: [published]
98

109
jobs:
1110
build:
1211
runs-on: ubuntu-latest
12+
13+
env:
14+
DOCKER_TAG: ${{ github.ref_type == 'tag' && github.ref_name || 'latest' }}
15+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
16+
1317
steps:
1418
- name: Checkout repository
1519
uses: actions/checkout@v4
@@ -23,15 +27,16 @@ jobs:
2327
username: ${{ secrets.DOCKERHUB_USERNAME }}
2428
password: ${{ secrets.DOCKERHUB_TOKEN }}
2529

26-
- name: Build and push images
27-
uses: docker/compose-action@v2
28-
with:
29-
compose-file: docker-compose.yml
30-
push: true
31-
build: true
32-
# Optional: specify tags via environment variable
33-
env:
34-
DOCKER_TAG: ${{ github.ref_type == 'tag' && github.ref_name || 'latest' }}
35-
36-
- name: Print tag info
37-
run: echo "Built and pushed images with tag $DOCKER_TAG"
30+
- name: Build and push each image
31+
run: |
32+
SERVICES=("hmi" "plc" "ews" "simulation" "router" "caldera" "kali")
33+
34+
for SERVICE in "${SERVICES[@]}"; do
35+
IMAGE="${DOCKERHUB_USERNAME}/grfics-${SERVICE}:${DOCKER_TAG}"
36+
echo "🚀 Building and pushing $IMAGE"
37+
docker build -t "$IMAGE" "./${SERVICE}"
38+
docker push "$IMAGE"
39+
done
40+
41+
- name: Print summary
42+
run: echo "✅ All images pushed with tag $DOCKER_TAG"

0 commit comments

Comments
 (0)