From 25f13a9ac18642bb2523e83cafd95ab63dc99779 Mon Sep 17 00:00:00 2001 From: ginruh Date: Sun, 16 Jun 2024 12:15:07 +0530 Subject: [PATCH 1/2] chore: updated docker-compose file --- docker-compose.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 77f30b0..c778570 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,9 @@ services: listener: - build: - context: . - dockerfile: Dockerfile + image: ghcr.io/ginruh/hckernews/listener:latest + + watchtower: + image: containrrr/watchtower + volumes: + - /var/run/docker.sock:/var/run/docker.sock + command: --interval 30 From ce4589bb08350964485be974e714db11784e5ad6 Mon Sep 17 00:00:00 2001 From: ginruh Date: Sun, 16 Jun 2024 12:49:30 +0530 Subject: [PATCH 2/2] feat: updated workflow --- .github/workflows/master.yml | 17 +++++++++++++++++ docker-compose.yml | 6 ------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 5a612b1..7f57e2f 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -33,3 +33,20 @@ jobs: file: src/listener/Dockerfile push: true tags: ghcr.io/${{ github.repository }}/listener:latest + + - name: Setup ssh key + run: | + mkdir -p ~/.ssh/ + echo "${{ secrets.ACTION_PRIVATE_KEY }}" > ~/.ssh/github_action.key + sudo chmod 600 ~/.ssh/github_action.key + ssh-keyscan -H ${{ secrets.SERVER_IP }} > ~/.ssh/known_hosts + + - name: Deploy + run: | + ssh {{ secrets.SERVER_USERNAME }}@{{ secrets.SERVER_IP }} /bin/bash << EOF + cd {{ secrets.REPO_PATH }}; + git pull origin master; + docker compose down; + docker compose pull; + docker compose up -d; + EOF diff --git a/docker-compose.yml b/docker-compose.yml index c778570..8835016 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,3 @@ services: listener: image: ghcr.io/ginruh/hckernews/listener:latest - - watchtower: - image: containrrr/watchtower - volumes: - - /var/run/docker.sock:/var/run/docker.sock - command: --interval 30