Resolve Issue #9 (Reorganizing dockerfiles and docker images CI/CD) #15
Workflow file for this run
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: download_convert_inference_totalseg | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
- name: Get Git Commit Hash | |
id: git-commit-hash | |
run: | | |
COMMIT_HASH=$(git rev-parse HEAD) | |
echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_ENV | |
- name: Copy additional files to build context | |
run: | | |
cp Dockerfiles/download_convert_inference_totalseg/weights_download.sh . | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfiles/download_convert_inference_totalseg/Dockerfile | |
tags: imagingdatacommons/download_convert_inference_totalseg | |
build-args: | | |
GIT_HASH=${{ env.COMMIT_HASH }} | |
env: | |
COMMIT_HASH: ${{ env.COMMIT_HASH }} | |
push-dockerhub: | |
needs: build | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Push Docker image to Docker Hub | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfiles/download_convert_inference_totalseg/Dockerfile | |
push: true | |
tags: imagingdatacommons/download_convert_inference_totalseg | |
push-ghcr: | |
needs: build | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry (ghcr.io) | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push Docker image to GitHub Container Registry | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfiles/download_convert_inference_totalseg/Dockerfile | |
push: true | |
tags: ghcr.io/imagingdatacommons/download_convert_inference_totalseg |