-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
build-push-docker.yml
workflow
- Loading branch information
1 parent
65decaf
commit fc85cef
Showing
2 changed files
with
107 additions
and
58 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: Build Argilla Docker image | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
download-python-package: | ||
description: "True if python package should be downloaded" | ||
type: boolean | ||
default: false | ||
image-name: | ||
description: "Name of the image to build" | ||
required: true | ||
type: string | ||
dockerfile: | ||
description: "Path to the Dockerfile to build" | ||
required: true | ||
type: string | ||
platforms: | ||
description: "Platforms to build for" | ||
required: true | ||
type: string | ||
build-args: | ||
description: "Build arguments" | ||
required: false | ||
type: string | ||
default: "" | ||
readme: | ||
description: "Path to the README file" | ||
required: false | ||
type: string | ||
default: "README.md" | ||
outputs: | ||
version: | ||
description: "Version of the Docker image" | ||
value: ${{ steps.meta.outputs.version }} | ||
|
||
jobs: | ||
build: | ||
name: Build Docker image | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.meta.outputs.version }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Download python package | ||
uses: actions/download-artifact@v3 | ||
if: ${{ inputs.download-python-package }} | ||
with: | ||
name: python-package | ||
path: docker/dist | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ inputs.image-name }} | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: docker | ||
file: ${{ inputs.dockerfile }} | ||
platforms: ${{ inputs.platforms }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: ${{ inputs.build-args }} | ||
load: true | ||
- name: Docker Hub Description | ||
uses: peter-evans/dockerhub-description@v3 | ||
if: github.event_name == 'release' | ||
with: | ||
username: ${{ secrets.AR_DOCKER_USERNAME }} | ||
password: ${{ secrets.AR_DOCKER_PASSWORD }} | ||
repository: ${{ inputs.image-name }} | ||
readme-filepath: ${{ inputs.readme }} |
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