Skip to content

Commit

Permalink
misc(ci/cd): Pull the images in server
Browse files Browse the repository at this point in the history
  • Loading branch information
xyzuan committed Nov 4, 2024
1 parent cfd0658 commit 455bc4b
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/build-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ 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 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 \
Expand All @@ -43,12 +43,23 @@ 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: Authenticating to Eden Server realms.
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SERVER_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts
- name: Serving the Images in Eden Server realms.
run: |
ssh -o StrictHostKeyChecking=no ${{ github.actor }}@${{ secrets.SERVER_HOST }} "echo 'Successfully logged in! Running deployment...'; docker pull ghcr.io/xyzuan/xyzuan_api_v2:dev; docker run -d -p 61131:3121 --name xyzuan-api-v2-dev ghcr.io/xyzuan/xyzuan_api_v2:dev"

0 comments on commit 455bc4b

Please sign in to comment.