Skip to content

Build and Push Docker Image #4

Build and Push Docker Image

Build and Push Docker Image #4

name: Build and Push Docker Image
on:
push:
# Trigger only when changes are made in these specific files or directories
paths:
- "setup.py"
- "README.md"
- "openml_tensorflow/**"
- "docs/Examples/**"
- "docker/Dockerfile"
- "docs/Docker reference/Docker.md"
workflow_dispatch: # allows manual trigger to the workflow
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.ORG_DOCKERHUB_USERNAME }}
password: ${{ secrets.ORG_DOCKERHUB_TOKEN }}
- name: Build Docker Image
run: |
docker build -t openml/openml-tensorflow:latest -f docker/Dockerfile .
- name: Push Docker Image
run: |
docker push openml/openml-tensorflow:latest
- name: Update Docker Hub Overview
run: |
# Extract the content of Docker.md
DESCRIPTION=$(cat docs/Docker\ reference/Docker.md)
# Authenticate with Docker Hub and update description
curl -X PATCH https://hub.docker.com/v2/repositories/openml/openml-tensorflow/ \
-H "Authorization: Bearer ${{ secrets.ORG_DOCKERHUB_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{\"full_description\": \"$DESCRIPTION\"}"