From b97e4dccff763d8227fdddabe9481daeb22ebbca Mon Sep 17 00:00:00 2001 From: Dharini Dutia Date: Tue, 13 Jun 2023 22:24:44 +0000 Subject: [PATCH 1/2] docker image push workflow Signed-off-by: Dharini Dutia --- .github/workflows/docker_build.yaml | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/docker_build.yaml diff --git a/.github/workflows/docker_build.yaml b/.github/workflows/docker_build.yaml new file mode 100644 index 00000000..3c48a99d --- /dev/null +++ b/.github/workflows/docker_build.yaml @@ -0,0 +1,46 @@ +name: Build and Push Docker image + +on: + push: + tags: + - 'v*' + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-22.04 + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v3 + with: + images: mbari/mbari_wec + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + + - name: Build Docker image + uses: docker/build-push-action@v2 + with: + context: ./docker/nvidia_opengl_ubuntu22 + file: ./docker/nvidia_opengl_ubuntu22/Dockerfile + push: false + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: ./docker/mbari_wec + file: ./docker/mbari_wec/Dockerfile + build-args: base=nvidia_opengl_ubuntu22:latest + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From a701fd17ace2f8622b0d494733a101928aaa456b Mon Sep 17 00:00:00 2001 From: Dharini Dutia Date: Wed, 21 Jun 2023 18:09:01 -0700 Subject: [PATCH 2/2] latest-rc tag by default --- .github/workflows/docker_build.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker_build.yaml b/.github/workflows/docker_build.yaml index 3c48a99d..c5850020 100644 --- a/.github/workflows/docker_build.yaml +++ b/.github/workflows/docker_build.yaml @@ -24,9 +24,11 @@ jobs: uses: docker/metadata-action@v3 with: images: mbari/mbari_wec + flavor: | + latest=true + suffix='-rc',onlatest=true tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} + type=ref,event=tag - name: Build Docker image uses: docker/build-push-action@v2 @@ -43,4 +45,3 @@ jobs: build-args: base=nvidia_opengl_ubuntu22:latest push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }}