Skip to content

Commit 0ab2695

Browse files
Merge pull request #1219 from openml/feature/github-action-publish-docker
Github action to publish docker image for every new version tag
2 parents 97e13b8 + 0d95b11 commit 0ab2695

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: release-docker
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- 'v*'
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
15+
docker:
16+
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v3
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Login to DockerHub
27+
if: github.event_name != 'pull_request'
28+
uses: docker/login-action@v3
29+
with:
30+
username: ${{ secrets.DOCKERHUB_USERNAME }}
31+
password: ${{ secrets.DOCKERHUB_TOKEN }}
32+
33+
- name: Check out the repo
34+
uses: actions/checkout@v4
35+
36+
- name: Extract metadata (tags, labels) for Docker Hub
37+
id: meta_dockerhub
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: "openml/php-rest-api"
41+
42+
- name: Build and push
43+
id: docker_build
44+
uses: docker/build-push-action@v6
45+
with:
46+
context: .
47+
file: docker/Dockerfile
48+
tags: "dev_${{ steps.meta_dockerhub.outputs.tags }}"
49+
labels: ${{ steps.meta_dockerhub.outputs.labels }}
50+
platforms: linux/amd64,linux/arm64
51+
push: ${{ github.event_name == 'push' }}
52+
53+
- name: Update repo description
54+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
55+
uses: peter-evans/dockerhub-description@v4
56+
with:
57+
username: ${{ secrets.DOCKERHUB_USERNAME }}
58+
password: ${{ secrets.DOCKERHUB_TOKEN }}
59+
repository: openml/php-rest-api
60+
short-description: "PHP rest api for OpenML."
61+
readme-filepath: ./docker/README.md
62+
63+
- name: Image digest
64+
run: echo ${{ steps.docker_build.outputs.digest }}

0 commit comments

Comments
 (0)