From 12c31df0c3e04f51903694e616a3c42069aeacf0 Mon Sep 17 00:00:00 2001 From: Sung Yun <107272191+sungwy@users.noreply.github.com> Date: Fri, 22 Nov 2024 10:08:53 -0500 Subject: [PATCH 1/7] Create publish-docker.yml --- .github/workflows/publish-docker.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/publish-docker.yml diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml new file mode 100644 index 000000000000..413306ee817d --- /dev/null +++ b/.github/workflows/publish-docker.yml @@ -0,0 +1,21 @@ + name: Build and Push Docker Image + + + + on: + workflow_dispatch: + + jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Login to Docker Hub + run: | + docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build Iceberg Open API project + run: ./gradlew :iceberg-open-api:shadowJar + - name: Build Docker Image + run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}iceberg-rest-adapter -f docker/iceberg-rest-adapter-image/Dockerfile . + - name: Push Docker Image + run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/iceberg-rest-adapter:latest From 0f7c89ad0cb5875d5d8c5da7ecedb91b3dffbe84 Mon Sep 17 00:00:00 2001 From: Sung Yun <107272191+sungwy@users.noreply.github.com> Date: Fri, 22 Nov 2024 10:13:09 -0500 Subject: [PATCH 2/7] fix vars --- .github/workflows/publish-docker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index 413306ee817d..15bff061e744 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -12,10 +12,10 @@ - uses: actions/checkout@v3 - name: Login to Docker Hub run: | - docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} + docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }} - name: Build Iceberg Open API project run: ./gradlew :iceberg-open-api:shadowJar - name: Build Docker Image - run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}iceberg-rest-adapter -f docker/iceberg-rest-adapter-image/Dockerfile . + run: docker build -t apache/iceberg-rest-adapter -f docker/iceberg-rest-adapter-image/Dockerfile . - name: Push Docker Image - run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/iceberg-rest-adapter:latest + run: docker push apache/iceberg-rest-adapter:latest From 548baac125c2a0a2bf47a2c41b65c32db4e7d65c Mon Sep 17 00:00:00 2001 From: Sung Yun <107272191+sungwy@users.noreply.github.com> Date: Fri, 22 Nov 2024 10:14:43 -0500 Subject: [PATCH 3/7] add license --- .github/workflows/publish-docker.yml | 53 ++++++++++++++++++---------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index 15bff061e744..33d45e21e760 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -1,21 +1,38 @@ - name: Build and Push Docker Image +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +name: Build and Push Docker Image +on: + workflow_dispatch: - on: - workflow_dispatch: - - jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Login to Docker Hub - run: | - docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build Iceberg Open API project - run: ./gradlew :iceberg-open-api:shadowJar - - name: Build Docker Image - run: docker build -t apache/iceberg-rest-adapter -f docker/iceberg-rest-adapter-image/Dockerfile . - - name: Push Docker Image - run: docker push apache/iceberg-rest-adapter:latest +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Login to Docker Hub + run: | + docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build Iceberg Open API project + run: ./gradlew :iceberg-open-api:shadowJar + - name: Build Docker Image + run: docker build -t apache/iceberg-rest-adapter -f docker/iceberg-rest-adapter-image/Dockerfile . + - name: Push Docker Image + run: docker push apache/iceberg-rest-adapter:latest From b4664a7a9b180c95191517a1bd0502cc16c011c9 Mon Sep 17 00:00:00 2001 From: Sung Yun <107272191+sungwy@users.noreply.github.com> Date: Fri, 22 Nov 2024 10:43:57 -0500 Subject: [PATCH 4/7] checkout java --- .github/workflows/publish-docker.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index 33d45e21e760..001fccdaf944 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -27,11 +27,15 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 21 + - name: Build Iceberg Open API project + run: ./gradlew :iceberg-open-api:shadowJar - name: Login to Docker Hub run: | docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build Iceberg Open API project - run: ./gradlew :iceberg-open-api:shadowJar - name: Build Docker Image run: docker build -t apache/iceberg-rest-adapter -f docker/iceberg-rest-adapter-image/Dockerfile . - name: Push Docker Image From dc1b668733e95abec8e1529bd125ef2f9df8a260 Mon Sep 17 00:00:00 2001 From: Sung Yun <107272191+sungwy@users.noreply.github.com> Date: Sun, 24 Nov 2024 22:50:46 -0500 Subject: [PATCH 5/7] Publish with version tag on tag push event --- .github/workflows/publish-docker.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index 001fccdaf944..41fd81366835 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -20,6 +20,9 @@ name: Build and Push Docker Image on: + push: + tags: + - 'apache-iceberg-[0-9]+.[0-9]+.[0-9]+' workflow_dispatch: jobs: @@ -38,5 +41,11 @@ jobs: docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }} - name: Build Docker Image run: docker build -t apache/iceberg-rest-adapter -f docker/iceberg-rest-adapter-image/Dockerfile . - - name: Push Docker Image + - name: Push Docker Image with latest tag + if: github.event_name == 'workflow_dispatch' run: docker push apache/iceberg-rest-adapter:latest + - name: Push Docker Image with version tag + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + run: | + echo "TAG=`echo ${{ github.ref }} | tr -d -c 0-9.`" >>${GITHUB_ENV} + docker push apache/iceberg-rest-adapter:$TAG From 15507b16237a3eda7405476018de51349abb1baa Mon Sep 17 00:00:00 2001 From: Sung Yun <107272191+sungwy@users.noreply.github.com> Date: Thu, 28 Nov 2024 13:49:53 -0500 Subject: [PATCH 6/7] rename docker image --- .github/workflows/publish-docker.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index 41fd81366835..2c03c4b3af70 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -25,6 +25,9 @@ on: - 'apache-iceberg-[0-9]+.[0-9]+.[0-9]+' workflow_dispatch: +env: + DOCKER_IMAGE_TAG: apache/iceberg-rest-fixture + jobs: build: runs-on: ubuntu-latest @@ -40,12 +43,12 @@ jobs: run: | docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }} - name: Build Docker Image - run: docker build -t apache/iceberg-rest-adapter -f docker/iceberg-rest-adapter-image/Dockerfile . + run: docker build -t $DOCKER_IMAGE_TAG -f docker/iceberg-rest-adapter-image/Dockerfile . - name: Push Docker Image with latest tag if: github.event_name == 'workflow_dispatch' - run: docker push apache/iceberg-rest-adapter:latest + run: docker push $DOCKER_IMAGE_TAG:latest - name: Push Docker Image with version tag if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') run: | echo "TAG=`echo ${{ github.ref }} | tr -d -c 0-9.`" >>${GITHUB_ENV} - docker push apache/iceberg-rest-adapter:$TAG + docker push $DOCKER_IMAGE_TAG:$TAG From 134d3fea14cadde5fb9de5f48222e123051b34c2 Mon Sep 17 00:00:00 2001 From: Sung Yun <107272191+sungwy@users.noreply.github.com> Date: Thu, 28 Nov 2024 14:04:17 -0500 Subject: [PATCH 7/7] use DOCKERHUB_NAME variable in tag --- .github/workflows/publish-docker.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index 2c03c4b3af70..3caf2dd4c694 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -26,7 +26,7 @@ on: workflow_dispatch: env: - DOCKER_IMAGE_TAG: apache/iceberg-rest-fixture + DOCKER_IMAGE_TAG: iceberg-rest-fixture jobs: build: @@ -43,12 +43,12 @@ jobs: run: | docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }} - name: Build Docker Image - run: docker build -t $DOCKER_IMAGE_TAG -f docker/iceberg-rest-adapter-image/Dockerfile . + run: docker build -t ${{ secrets.DOCKERHUB_USER }}/$DOCKER_IMAGE_TAG -f docker/iceberg-rest-adapter-image/Dockerfile . - name: Push Docker Image with latest tag if: github.event_name == 'workflow_dispatch' - run: docker push $DOCKER_IMAGE_TAG:latest + run: docker push ${{ secrets.DOCKERHUB_USER }}/$DOCKER_IMAGE_TAG:latest - name: Push Docker Image with version tag if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') run: | echo "TAG=`echo ${{ github.ref }} | tr -d -c 0-9.`" >>${GITHUB_ENV} - docker push $DOCKER_IMAGE_TAG:$TAG + docker push ${{ secrets.DOCKERHUB_USER }}/$DOCKER_IMAGE_TAG:$TAG