Skip to content

Commit

Permalink
ci/cd
Browse files Browse the repository at this point in the history
  • Loading branch information
M397749490 committed Mar 20, 2024
1 parent 15a8f3b commit cbe8de2
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions .github/workflows/build.yml → .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
name: Backend Server CI
name: Docker Image CI

on:
push:
branches: [ main ]
workflow_dispatch:
branches: [ "main" ]

jobs:
ci:
build_docker:
name: Build docker
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push Docker Image
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
Expand All @@ -33,3 +31,18 @@ jobs:
${{ secrets.DOCKERHUB_USERNAME }}/toyou-backend:latest
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
name: Deploy
needs: build_docker
runs-on: ubuntu-latest
steps:
- name: SSH To Host
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd ${{ secrets.PROJ_PATH }}
sudo bash ./deploy.sh

0 comments on commit cbe8de2

Please sign in to comment.