Skip to content

Resolve Issue #9 (Reorganizing dockerfiles and docker images CI/CD) #12

Resolve Issue #9 (Reorganizing dockerfiles and docker images CI/CD)

Resolve Issue #9 (Reorganizing dockerfiles and docker images CI/CD) #12

name: inference_totalseg
on:
pull_request:
branches: [ "main" ]
jobs:
build-and-push:
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/inference_totalseg/weights_download.sh .
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfiles/inference_totalseg/Dockerfile
push: true
tags: imagingdatacommons/inference_totalseg
build-args: |
GIT_HASH=${{ env.COMMIT_HASH }}
env:
COMMIT_HASH: ${{ env.COMMIT_HASH }}
- 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: Build and push Docker image to GitHub Container Registry
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfiles/inference_totalseg/Dockerfile
push: true
tags: ghcr.io/imagingdatacommons/inference_totalseg
build-args: |
GIT_HASH=${{ env.COMMIT_HASH }}
env:
COMMIT_HASH: ${{ env.COMMIT_HASH }}