Build and Push Docker Image #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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\"}" | |