-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#4) Co-authored-by: Mohamadamin Karami <[email protected]>
- Loading branch information
1 parent
3473140
commit 82f674d
Showing
1 changed file
with
118 additions
and
0 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,118 @@ | ||
name: Docker Build, Push Images | ||
|
||
on: | ||
release: | ||
types: [published] | ||
env: | ||
RELEASE: ${{ github.event.release.tag_name || 'latest' }} | ||
|
||
jobs: | ||
build-base-images: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build and tag dish pash base image | ||
run: | | ||
cd docker-hadoop | ||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/dish-pash-base:${{ env.RELEASE }} ./pash-base \ | ||
--build-arg RELEASE=${{ env.RELEASE }} | ||
# Tag the image with 'latest' | ||
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/dish-pash-base:${{ env.RELEASE }} \ | ||
${{ secrets.DOCKERHUB_USERNAME }}/dish-pash-base:latest | ||
- name: Push dish pash base image | ||
run: | | ||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/dish-pash-base:${{ env.RELEASE }} | ||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/dish-pash-base:latest | ||
- name: Build and tag hadoop pash base image | ||
run: | | ||
cd docker-hadoop | ||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/hadoop-pash-base:${{ env.RELEASE }} ./base \ | ||
--build-arg RELEASE=${{ env.RELEASE }} --build-arg BASE=${{ secrets.DOCKERHUB_USERNAME }}/dish-pash-base | ||
# Tag the image with 'latest' | ||
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/hadoop-pash-base:${{ env.RELEASE }} \ | ||
${{ secrets.DOCKERHUB_USERNAME }}/hadoop-pash-base:latest | ||
- name: Push hadoop pash base image | ||
run: | | ||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/hadoop-pash-base:${{ env.RELEASE }} | ||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/hadoop-pash-base:latest | ||
build-dependant-images: | ||
runs-on: ubuntu-latest | ||
needs: build-base-images | ||
|
||
strategy: | ||
matrix: | ||
image: | ||
- name: hadoop-namenode | ||
path: ./namenode | ||
base_image: hadoop-pash-base | ||
|
||
- name: hadoop-datanode | ||
path: ./datanode | ||
base_image: hadoop-pash-base | ||
|
||
- name: hadoop-resourcemanager | ||
path: ./resourcemanager | ||
base_image: hadoop-pash-base | ||
|
||
- name: hadoop-nodemanager | ||
path: ./nodemanager | ||
base_image: hadoop-pash-base | ||
|
||
- name: hadoop-historyserver | ||
path: ./historyserver | ||
base_image: hadoop-pash-base | ||
|
||
- name: hadoop-submit | ||
path: ./submit | ||
base_image: hadoop-pash-base | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build and tag Docker image | ||
run: | | ||
cd docker-hadoop | ||
# Build Image | ||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image.name }}:${{ env.RELEASE }} ${{ matrix.image.path }} \ | ||
--build-arg RELEASE=${{ env.RELEASE }} --build-arg BASE=${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image.base_image }} | ||
# Tag the image with 'latest' | ||
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image.name }}:${{ env.RELEASE }} ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image.name }}:latest | ||
- name: Push Docker image | ||
run: | | ||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image.name }}:${{ env.RELEASE }} | ||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image.name }}:latest |