generated from odtp-org/odtp-component-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
760 additions
and
180 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
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,57 @@ | ||
name: Multi-Platform Docker Build | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Step 1: Check out the repository and submodules | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true # Fetch submodules | ||
fetch-depth: 0 # Ensure the full history is fetched | ||
|
||
# Step 2: Set up Docker Buildx | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
# Step 3: Install yq | ||
- name: Install yq | ||
run: | | ||
sudo apt-get update && sudo apt-get install -y wget | ||
sudo wget https://github.com/mikefarah/yq/releases/download/v4.35.1/yq_linux_amd64 -O /usr/bin/yq | ||
sudo chmod +x /usr/bin/yq | ||
# Step 4: Extract component-version and component-name from odtp.yml | ||
- name: Extract component-version and component-name | ||
id: extract_info | ||
run: | | ||
VERSION=$(yq e '.component-version' odtp.yml) | ||
NAME=$(yq e '.component-name' odtp.yml) | ||
echo "VERSION=${VERSION}" | ||
echo "NAME=${NAME}" | ||
echo "COMPONENT_VERSION=${VERSION}" >> $GITHUB_ENV | ||
echo "COMPONENT_NAME=${NAME}" >> $GITHUB_ENV | ||
# Step 5: Log in to GitHub Container Registry | ||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Step 6: Build and push Docker image for multiple platforms | ||
- name: Build and push Docker image | ||
run: | | ||
IMAGE_NAME=ghcr.io/${{ github.repository }}/${{ env.COMPONENT_NAME }} | ||
docker buildx build \ | ||
--platform linux/amd64,linux/arm64 \ | ||
--build-arg COMPONENT_VERSION=${{ env.COMPONENT_VERSION }} \ | ||
-t $IMAGE_NAME:${{ env.COMPONENT_VERSION }} \ | ||
-t $IMAGE_NAME:latest \ | ||
--push . |
56 changes: 56 additions & 0 deletions
56
.github/workflows/multiplatform_docker_build_dockerhub.yml
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,56 @@ | ||
name: Multi-Platform Docker Build for Dockerhub | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Step 1: Check out the repository and submodules | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true # Fetch submodules | ||
fetch-depth: 0 # Ensure the full history is fetched | ||
|
||
# Step 2: Set up Docker Buildx | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
# Step 3: Install yq | ||
- name: Install yq | ||
run: | | ||
sudo apt-get update && sudo apt-get install -y wget | ||
sudo wget https://github.com/mikefarah/yq/releases/download/v4.35.1/yq_linux_amd64 -O /usr/bin/yq | ||
sudo chmod +x /usr/bin/yq | ||
# Step 4: Extract component-version and component-name from odtp.yml | ||
- name: Extract component-version and component-name | ||
id: extract_info | ||
run: | | ||
VERSION=$(yq e '.component-version' odtp.yml) | ||
NAME=$(yq e '.component-name' odtp.yml) | ||
echo "VERSION=${VERSION}" | ||
echo "NAME=${NAME}" | ||
echo "COMPONENT_VERSION=${VERSION}" >> $GITHUB_ENV | ||
echo "COMPONENT_NAME=${NAME}" >> $GITHUB_ENV | ||
# Step 5: Log in to Docker Hub | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
# Step 6: Build and push Docker image for multiple platforms | ||
- name: Build and push Docker image | ||
run: | | ||
IMAGE_NAME=${{ secrets.DOCKER_USERNAME }}/${{ env.COMPONENT_NAME }} | ||
docker buildx build \ | ||
--platform linux/amd64,linux/arm64 \ | ||
--build-arg COMPONENT_VERSION=${{ env.COMPONENT_VERSION }} \ | ||
-t $IMAGE_NAME:${{ env.COMPONENT_VERSION }} \ | ||
-t $IMAGE_NAME:latest \ | ||
--push . |
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,20 @@ | ||
name: Sync to Hugging Face hub | ||
on: | ||
push: | ||
branches: [main] | ||
# to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
sync-to-hub: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
lfs: true | ||
- name: Push to hub | ||
env: | ||
HF_TOKEN: ${{ secrets.HF_TOKEN }} | ||
HF_USERNAME: ${{secrets.HF_USERNAME}} | ||
run: git push --force https://$HF_USERNAME:[email protected]/spaces/katospiegel/odtp-pyannote-whisper main |
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
Oops, something went wrong.