Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate docker image build and push to dockerhub #55

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/docker_build.yaml
Original file line number Diff line number Diff line change
@@ -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}}
quarkytale marked this conversation as resolved.
Show resolved Hide resolved

- 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 }}