diff --git a/.github/workflows/container-build-test.yml b/.github/workflows/container-build-test.yml new file mode 100644 index 0000000..d6db9c6 --- /dev/null +++ b/.github/workflows/container-build-test.yml @@ -0,0 +1,42 @@ +name: Container Build Test + +on: + workflow_dispatch: + push: + branches-ignore: + - main + pull_request: + branches: + - main + +jobs: + build: + name: Build container + runs-on: ubuntu-latest + + steps: + - name: Checkout code + id: checkout + uses: actions/checkout@v2 + + - name: Set up QEMU + id: qemu + if: success() + uses: docker/setup-qemu-action@v1 + with: + platforms: arm64 + + - name: Set up Docker Buildx + id: buildx + if: success() + uses: docker/setup-buildx-action@v1 + + - name: Build container + id: build + if: success() + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + platforms: arm64 + tags: ${{ github.repository }}:container-build-test-${{ github.RUN_NUMBER }} diff --git a/.github/workflows/container-release.yml b/.github/workflows/container-release.yml new file mode 100644 index 0000000..9c3205a --- /dev/null +++ b/.github/workflows/container-release.yml @@ -0,0 +1,58 @@ +name: Container Release + +on: + push: + tags: + - v* + branches: main + +jobs: + build: + name: Build container + runs-on: ubuntu-latest + + steps: + - name: Checkout code + id: checkout + uses: actions/checkout@v2 + + - name: Get Tag name + id: tag + if: success() + run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} + + - name: Set up QEMU + id: qemu + if: success() + uses: docker/setup-qemu-action@v1 + with: + platforms: arm64 + + - name: Set up Docker Buildx + id: buildx + if: success() + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + id: login + if: success() + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_ACCESSTOKEN }} + + - name: Push to Docker Hub + id: push_dockerhub + if: success() + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + platforms: arm64 + push: true + tags: ${{ github.repository }}:latest,${{ github.repository }}:latest,${{ github.repository }}:latest,${{ github.repository }}:${{ steps.tag.outputs.tag }} + + - name: Image digest Docker Hub + id: digest_dockerhub + if: success() + run: echo ${{ steps.push_dockerhub.outputs.digest }}