diff --git a/.github/workflows/docker_build.yaml b/.github/workflows/docker_build.yaml new file mode 100644 index 00000000..c5850020 --- /dev/null +++ b/.github/workflows/docker_build.yaml @@ -0,0 +1,47 @@ +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 + flavor: | + latest=true + suffix='-rc',onlatest=true + tags: | + type=ref,event=tag + + - 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 }}