-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #109 from bart2001/feature/github-action
[CI/CD] add github action file for building and publishing docker image
- Loading branch information
Showing
1 changed file
with
38 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,38 @@ | ||
name: Build and Publish Docker Container | ||
on: | ||
push: | ||
tags: [ 'fe*.*.*', 'api*.*.*' ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get tag | ||
id: tag | ||
uses: dawidd6/action-get-tag@v1 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build & Push Docker Image (FrontEnd) | ||
if : ${{ startsWith(steps.tag.outputs.tag, 'fe') }} | ||
run: | | ||
docker build -t ${{ secrets.DOCKERHUB_FRONTEND_REPO }}:release-${{ steps.tag.outputs.tag }} ./ --no-cache | ||
docker tag ${{ secrets.DOCKERHUB_FRONTEND_REPO }}:release-${{ steps.tag.outputs.tag }} ${{ secrets.DOCKERHUB_FRONTEND_REPO }}:latest | ||
docker push ${{ secrets.DOCKERHUB_FRONTEND_REPO }}:release-${{ steps.tag.outputs.tag }} | ||
docker push ${{ secrets.DOCKERHUB_FRONTEND_REPO }}:latest | ||
- name: Build & Push Docker Image (BackEnd) | ||
if : ${{ startsWith(steps.tag.outputs.tag, 'api') }} | ||
run: | | ||
cd api | ||
docker build -t ${{ secrets.DOCKERHUB_BACKEND_REPO }}:release-${{ steps.tag.outputs.tag }} ./ --no-cache | ||
docker tag ${{ secrets.DOCKERHUB_BACKEND_REPO }}:release-${{ steps.tag.outputs.tag }} ${{ secrets.DOCKERHUB_BACKEND_REPO }}:latest | ||
docker push ${{ secrets.DOCKERHUB_BACKEND_REPO }}:release-${{ steps.tag.outputs.tag }} | ||
docker push ${{ secrets.DOCKERHUB_BACKEND_REPO }}:latest |