Create and push dockerfiles #25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Create and push dockerfiles | |
| on: | |
| workflow_dispatch: | |
| release: | |
| types: [released] | |
| jobs: | |
| update-latest-tag: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Git | |
| run: | | |
| git config user.name "${{ github.actor }}" | |
| git config user.email "${{ github.actor }}@users.noreply.github.com" | |
| - name: Delete existing latest tag (if exists) | |
| run: | | |
| git push --delete origin latest || true | |
| git tag -d latest || true | |
| - name: Tag Latest Release | |
| run: | | |
| # Get the latest release tag | |
| latest_tag=$(git describe --tags --abbrev=0 --always) | |
| # Get the commit hash of the latest release | |
| latest_commit=$(git rev-list -n 1 $latest_tag) | |
| # Create a new tag based on the latest commit | |
| git tag -a latest -m "Latest release" $latest_commit | |
| # Push the new tag to the repository | |
| git push origin latest | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} | |
| build-and-push-dockerfile-images: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Set JAVA_HOME | |
| run: | | |
| echo "JAVA_8_HOME=$JAVA_HOME_8_X64" >> $GITHUB_ENV | |
| echo "JAVA_11_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV | |
| echo "JAVA_17_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV | |
| echo "JAVA_HOME=$JAVA_HOME_8_X64" >> $GITHUB_ENV | |
| - name: Build Project | |
| run: mvn install -DskipTests=true | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.docker_username }} | |
| password: ${{ secrets.docker_token }} | |
| - name: Build Docker Images | |
| run: | | |
| mvn docker:build -pl agent-module/agent | |
| mvn docker:build -pl flink | |
| mvn docker:build -pl hbase/hbase-docker | |
| docker images | |
| - name: Push to Docker Hub | |
| run: | | |
| docker push --all-tags ${{ secrets.docker_username }}/pinpoint-agent | |
| docker push --all-tags ${{ secrets.docker_username }}/pinpoint-flink | |
| docker push --all-tags ${{ secrets.docker_username }}/pinpoint-hbase | |
| build-and-push-spring-boot-docker-images: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Set JAVA_HOME | |
| run: | | |
| echo "JAVA_8_HOME=$JAVA_HOME_8_X64" >> $GITHUB_ENV | |
| echo "JAVA_11_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV | |
| echo "JAVA_17_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV | |
| echo "JAVA_HOME=$JAVA_HOME_8_X64" >> $GITHUB_ENV | |
| - name: Build Project | |
| run: mvn install -DskipTests=true | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.docker_username }} | |
| password: ${{ secrets.docker_token }} | |
| - name: Build Docker Images | |
| run: | | |
| # Set up Buildx for multi-arch Spring Boot builds | |
| docker buildx create --use --name multiarch-builder || true | |
| docker buildx inspect --bootstrap | |
| mvn -pl collector clean package spring-boot:build-image -DskipTests=true -Dspring-boot.build-image.platform=linux/amd64,linux/arm64 | |
| mvn -pl collector-starter clean package spring-boot:build-image -DskipTests=true -Dspring-boot.build-image.platform=linux/amd64,linux/arm64 | |
| mvn -pl web clean package spring-boot:build-image -DskipTests=true -Dspring-boot.build-image.platform=linux/amd64,linux/arm64 | |
| mvn -pl web-starter clean package spring-boot:build-image -DskipTests=true -Dspring-boot.build-image.platform=linux/amd64,linux/arm64 | |
| mvn -pl batch clean package spring-boot:build-image -DskipTests=true -Dspring-boot.build-image.platform=linux/amd64,linux/arm64 | |
| docker images | |
| - name: Push to Docker Hub | |
| run: | | |
| docker push --all-tags ${{ secrets.docker_username }}/pinpoint-batch | |
| docker push --all-tags ${{ secrets.docker_username }}/pinpoint-collector | |
| docker push --all-tags ${{ secrets.docker_username }}/pinpoint-web | |