Skip to content

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

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

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

name: download_convert
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: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image to Docker Hub
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfiles/download_convert/Dockerfile
push: true
tags: imagingdatacommons/download_convert
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/download_convert/Dockerfile
push: true
tags: ghcr.io/imagingdatacommons/download_convert
build-args: |
GIT_HASH=${{ env.COMMIT_HASH }}
env:
COMMIT_HASH: ${{ env.COMMIT_HASH }}