-
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.
misc(ci/cd): Pull the images in server
- Loading branch information
Showing
1 changed file
with
28 additions
and
5 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 |
---|---|---|
|
@@ -16,13 +16,18 @@ jobs: | |
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
- name: Settle up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to Github Container Registry | ||
- name: Authenticating to Eden Server realms. | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.SERVER_PRIVATE_KEY }} | ||
|
||
- name: Authenticating to GHCR realms | ||
run: echo "${{ secrets.GH_TOKEN }}" | docker login -u "${{ github.actor }}" ghcr.io --password-stdin | ||
|
||
- name: Build Docker image | ||
- name: Treaty Build the Docker image | ||
run: | | ||
docker build \ | ||
--build-arg PORT=3121 \ | ||
|
@@ -43,12 +48,30 @@ jobs: | |
--build-arg CLOUDINARY_API_SECRET=${{ secrets.CLOUDINARY_API_SECRET }} \ | ||
-t ghcr.io/xyzuan/xyzuan_api_v2:dev -f misc/Dockerfile.dev . | ||
- name: Tag Docker image | ||
- name: Adding tags to the Images | ||
run: | | ||
IMAGE_NAME=ghcr.io/xyzuan/xyzuan_api_v2 | ||
docker tag $IMAGE_NAME:dev $IMAGE_NAME:$(echo "${{ github.sha }}" | head -c 7) | ||
- name: Push Docker image | ||
- name: Bring the Images to GHCR | ||
run: | | ||
docker push ghcr.io/xyzuan/xyzuan_api_v2:dev | ||
docker push ghcr.io/xyzuan/xyzuan_api_v2:$(echo "${{ github.sha }}" | head -c 7) | ||
- name: Serving the Images in Eden Server realms. | ||
run: | | ||
ssh-keyscan -t rsa ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts | ||
ssh ${{ github.actor }}@${{ secrets.SERVER_HOST }} << 'EOF' | ||
echo 'Authenticating to GHCR realms...' | ||
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:dev | ||
echo 'Force Blowing the exist Docker Container...' | ||
docker rm -f xyzuan-api-v2-dev | ||
echo 'Running the Docker Container...' | ||
docker run -d -p 61131:3121 --name xyzuan-api-v2-dev ghcr.io/xyzuan/xyzuan_api_v2:dev | ||
EOF |