Skip to content

Commit 2f2a353

Browse files
committed
ci(docker): auto build image
1 parent 83acad5 commit 2f2a353

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.github/workflows/image.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# This workflow will build a Java project with Maven
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
4+
name: PIG 镜像 action
5+
6+
on:
7+
push:
8+
branches: [ jdk17-dev ]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
java-version: [ 17 ]
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up JDK ${{ matrix.java-version }}
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: ${{ matrix.java-version }}
22+
distribution: 'zulu'
23+
24+
- name: mvn clean install
25+
run: mvn clean install -Pcloud
26+
27+
- name: Login to Docker Registry
28+
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} registry.cn-hangzhou.aliyuncs.com
29+
30+
- name: Build and push Docker images
31+
run: |
32+
docker-compose build
33+
registry="registry.cn-hangzhou.aliyuncs.com/pigx/"
34+
for service in $(docker-compose config --services); do
35+
if [ "$service" != "pig-redis" ]; then
36+
docker tag ${service}:latest ${registry}${service}:latest
37+
docker push ${registry}${service}:latest
38+
else
39+
echo "Skipping pig-redis service"
40+
fi
41+
done

0 commit comments

Comments
 (0)