Skip to content

Commit

Permalink
feature: CI-CD
Browse files Browse the repository at this point in the history
  • Loading branch information
masnann authored Nov 8, 2023
1 parent 205ae26 commit 442173d
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Docker Image CI

on:
push:
branches: "develop"

jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/test_disappear:latest
-
name: connect ssh
uses: appleboy/ssh-action@v0.1.9
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
sudo docker stop ${{ secrets.CNAME }}
sudo docker rm ${{ secrets.CNAME }}
sudo docker rmi ${{ secrets.DOCKERHUB_USERNAME }}/test_disappear
sudo docker run --name ${{ secrets.CNAME }} -p 8000:8000 -d -e DBHOST=${{secrets.DBHOST}} -e DBPORT=3306 -e DBUSER=${{secrets.DBUSER}} -e DBNAME=${{secrets.DBNAME}} -e DBPASS=${{secrets.DBPASS}} -e SECRET=${{secrets.SECRET}} -e SERVER=8000 ${{ secrets.DOCKERHUB_USERNAME }}/test_disappear

0 comments on commit 442173d

Please sign in to comment.