CI to Docker Hub #269
This file contains 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: CI to Docker Hub | |
on: | |
schedule: | |
- cron: '0 0 * * 6' | |
push: | |
branches: | |
- main | |
jobs: | |
build_dist: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Cache Buildx layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: buildx-${{ runner.os }}-${{ github.sha }} | |
restore-keys: | | |
buildx-${{ runner.os }} | |
- | |
name: Build Hadoop dist | |
run: make hadoop-dist.iid cache=/tmp/.buildx-cache | |
- | |
name: Upload Dist | |
uses: actions/upload-artifact@v3 | |
with: | |
name: hadoop-dist | |
path: /tmp/.buildx-cache | |
if-no-files-found: error | |
build_images: | |
needs: [build_dist] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java_version: [8, 11] | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Download Dist | |
uses: actions/download-artifact@v3 | |
with: | |
name: hadoop-dist | |
path: /tmp/.buildx-cache | |
- | |
name: Build sandbox images | |
run: make all java_version=${{ matrix.java_version }} docker_org=${{ secrets.DOCKERHUB_USERNAME }} cache=/tmp/.buildx-cache | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Push images | |
id: push_images | |
run: make push java_version=${{ matrix.java_version }} docker_org=${{ secrets.DOCKERHUB_USERNAME }} cache=/tmp/.buildx-cache |