Skip to content

Commit 776412b

Browse files
authored
Add Spring Boot Docker image build and push job
Added a new job for building and pushing Spring Boot Docker images, including multi-architecture support.
1 parent c3e7ec8 commit 776412b

File tree

1 file changed

+41
-16
lines changed

1 file changed

+41
-16
lines changed

.github/workflows/create-dockerfiles.yml

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on:
44
workflow_dispatch:
55
release:
66
types: [released]
7-
7+
88
jobs:
9-
latest:
9+
update-latest-tag:
1010
runs-on: ubuntu-22.04
1111
steps:
1212
- name: Checkout
@@ -21,24 +21,25 @@ jobs:
2121
run: |
2222
git push --delete origin latest || true
2323
git tag -d latest || true
24-
24+
2525
- name: Tag Latest Release
2626
run: |
2727
# Get the latest release tag
2828
latest_tag=$(git describe --tags --abbrev=0 --always)
29-
29+
3030
# Get the commit hash of the latest release
3131
latest_commit=$(git rev-list -n 1 $latest_tag)
32-
32+
3333
# Create a new tag based on the latest commit
3434
git tag -a latest -m "Latest release" $latest_commit
35-
35+
3636
# Push the new tag to the repository
3737
git push origin latest
3838
3939
env:
4040
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
4141

42+
build-and-push-dockerfile-images:
4243
- name: Set JAVA_HOME
4344
run: |
4445
echo "JAVA_8_HOME=$JAVA_HOME_8_X64" >> $GITHUB_ENV
@@ -60,22 +61,46 @@ jobs:
6061
mvn docker:build -pl agent-module/agent
6162
mvn docker:build -pl flink
6263
mvn docker:build -pl hbase/hbase-docker
63-
# Set up Buildx for multi-arch Spring Boot builds
64-
docker buildx create --use --name multiarch-builder || true
65-
docker buildx inspect --bootstrap
66-
mvn -pl collector-starter clean package spring-boot:build-image -DskipTests=true -Dspring-boot.build-image.platform=linux/amd64
67-
mvn -pl web-starter clean package spring-boot:build-image -DskipTests=true -Dspring-boot.build-image.platform=linux/amd64
68-
mvn -pl batch clean package spring-boot:build-image -DskipTests=true -Dspring-boot.build-image.platform=linux/amd64
69-
mvn -pl collector clean package spring-boot:build-image -DskipTests=true -Dspring-boot.build-image.platform=linux/amd64
70-
mvn -pl web clean package spring-boot:build-image -DskipTests=true -Dspring-boot.build-image.platform=linux/amd64
7164
docker images
72-
65+
7366
- name: Push to Docker Hub
7467
run: |
7568
docker push --all-tags ${{ secrets.docker_username }}/pinpoint-agent
7669
docker push --all-tags ${{ secrets.docker_username }}/pinpoint-flink
7770
docker push --all-tags ${{ secrets.docker_username }}/pinpoint-hbase
71+
72+
build-and-push-spring-boot-docker-images:
73+
- name: Set JAVA_HOME
74+
run: |
75+
echo "JAVA_8_HOME=$JAVA_HOME_8_X64" >> $GITHUB_ENV
76+
echo "JAVA_11_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV
77+
echo "JAVA_17_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
78+
echo "JAVA_HOME=$JAVA_HOME_8_X64" >> $GITHUB_ENV
79+
80+
- name: Build Project
81+
run: mvn install -DskipTests=true
82+
83+
- name: Log in to Docker Hub
84+
uses: docker/login-action@v3
85+
with:
86+
username: ${{ secrets.docker_username }}
87+
password: ${{ secrets.docker_token }}
88+
89+
- name: Build Docker Images
90+
run: |
91+
# Set up Buildx for multi-arch Spring Boot builds
92+
docker buildx create --use --name multiarch-builder || true
93+
docker buildx inspect --bootstrap
94+
mvn -pl collector clean package spring-boot:build-image -DskipTests=true -Dspring-boot.build-image.platform=linux/amd64,linux/arm64
95+
mvn -pl collector-starter clean package spring-boot:build-image -DskipTests=true -Dspring-boot.build-image.platform=linux/amd64,linux/arm64
96+
mvn -pl web clean package spring-boot:build-image -DskipTests=true -Dspring-boot.build-image.platform=linux/amd64,linux/arm64
97+
mvn -pl web-starter clean package spring-boot:build-image -DskipTests=true -Dspring-boot.build-image.platform=linux/amd64,linux/arm64
98+
mvn -pl batch clean package spring-boot:build-image -DskipTests=true -Dspring-boot.build-image.platform=linux/amd64,linux/arm64
99+
docker images
100+
101+
- name: Push to Docker Hub
102+
run: |
78103
docker push --all-tags ${{ secrets.docker_username }}/pinpoint-batch
79104
docker push --all-tags ${{ secrets.docker_username }}/pinpoint-collector
80105
docker push --all-tags ${{ secrets.docker_username }}/pinpoint-web
81-
106+

0 commit comments

Comments
 (0)