-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
22 additions
and
19 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 |
---|---|---|
|
@@ -18,10 +18,14 @@ jobs: | |
|
||
- name: Declaring some Global Environtment vars | ||
run: | | ||
BRANCH_NAME=${GITHUB_REF##*/} | ||
SHA=$(echo "$GITHUB_SHA" | head -c 7) | ||
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV | ||
echo "SHA=${SHA}" >> $GITHUB_ENV | ||
echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV | ||
echo "SHA=$(echo "$GITHUB_SHA" | head -c 7)" >> $GITHUB_ENV | ||
echo "ENV=dev" >> $GITHUB_ENV | ||
echo "PORT=3121" >> $GITHUB_ENV | ||
echo "DOMAIN=xyzuan.my.id" >> $GITHUB_ENV | ||
echo "REGISTRY=ghcr.io/xyzuan" >> $GITHUB_ENV | ||
echo "IMAGE_NAME=xyzuan_api_v2" >> $GITHUB_ENV | ||
echo "DOCKERFILE=misc/Dockerfile.dev" >> $GITHUB_ENV | ||
- name: Authenticating to Eden Server realms. | ||
uses: webfactory/[email protected] | ||
|
@@ -34,9 +38,9 @@ jobs: | |
- name: Treaty Build the Docker image | ||
run: | | ||
docker build \ | ||
--build-arg PORT=3121 \ | ||
--build-arg NODE_ENV=dev \ | ||
--build-arg DOMAIN=xyzuan.my.id \ | ||
--build-arg PORT=${{ env.PORT }} \ | ||
--build-arg NODE_ENV=${{ env.ENV }} \ | ||
--build-arg DOMAIN=${{ env.DOMAIN }} \ | ||
--build-arg PASSWORD_PEPPER=${{ secrets.PASSWORD_PEPPER }} \ | ||
--build-arg DATABASE_URL=${{ secrets.DATABASE_URL_DEV }} \ | ||
--build-arg GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }} \ | ||
|
@@ -50,17 +54,16 @@ jobs: | |
--build-arg CLOUDINARY_CLOUD_NAME=${{ secrets.CLOUDINARY_CLOUD_NAME }} \ | ||
--build-arg CLOUDINARY_API_KEY=${{ secrets.CLOUDINARY_API_KEY }} \ | ||
--build-arg CLOUDINARY_API_SECRET=${{ secrets.CLOUDINARY_API_SECRET }} \ | ||
-t ghcr.io/xyzuan/xyzuan_api_v2:${{ env.BRANCH_NAME }} -f misc/Dockerfile.dev . | ||
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }} -f ${{ env.DOCKERFILE }} . | ||
- name: Adding tags to the Images | ||
run: | | ||
IMAGE_NAME=ghcr.io/xyzuan/xyzuan_api_v2 | ||
docker tag $IMAGE_NAME:${{ env.BRANCH_NAME }} $IMAGE_NAME:${{env.SHA}} | ||
docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }} ${{ env.IMAGE_NAME }}:${{env.SHA}} | ||
- name: Bring the Images to GHCR | ||
run: | | ||
docker push ghcr.io/xyzuan/xyzuan_api_v2:${{ env.BRANCH_NAME }} | ||
docker push ghcr.io/xyzuan/xyzuan_api_v2:${{env.SHA}} | ||
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }} | ||
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{env.SHA}} | ||
- name: Serving the Images in Eden Server realms. | ||
run: | | ||
|
@@ -71,16 +74,16 @@ jobs: | |
echo "${{ secrets.GH_TOKEN }}" | docker login -u "${{ github.actor }}" ghcr.io --password-stdin | ||
echo 'Pulling the latest image from GHCR...' | ||
docker pull ghcr.io/xyzuan/xyzuan_api_v2:${{ env.BRANCH_NAME }} | ||
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }} | ||
echo 'Force Blowing the exist Docker Container...' | ||
docker rm -f xyzuan-api-v2-${{ env.BRANCH_NAME }} | ||
docker rm -f ${{ env.IMAGE_NAME }}-${{ env.BRANCH_NAME }} | ||
echo 'Running the Docker Container...' | ||
docker run -d \ | ||
--name xyzuan-api-v2-${{ env.BRANCH_NAME }} \ | ||
--name ${{ env.IMAGE_NAME }}-${{ env.BRANCH_NAME }} \ | ||
--restart always \ | ||
--network nginx_default \ | ||
-p 3121:3121 \ | ||
ghcr.io/xyzuan/xyzuan_api_v2:${{ env.BRANCH_NAME }} | ||
-p ${{ env.PORT }}:${{ env.PORT }} \ | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }} | ||
EOF |
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 |
---|---|---|
|
@@ -25,7 +25,7 @@ jobs: | |
echo "DOMAIN=xyzuan.my.id" >> $GITHUB_ENV | ||
echo "REGISTRY=ghcr.io/xyzuan" >> $GITHUB_ENV | ||
echo "IMAGE_NAME=xyzuan_api_v2" >> $GITHUB_ENV | ||
echo "DOCKERFILE=misc/Dockerfile.dev" >> $GITHUB_ENV | ||
echo "DOCKERFILE=misc/Dockerfile.prod" >> $GITHUB_ENV | ||
- name: Authenticating to Eden Server realms. | ||
uses: webfactory/[email protected] | ||
|
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