Add ci build and deploy
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Sambo Chea 2022-10-03 08:35:12 +07:00
parent fa973a8204
commit 5b5494108c
Signed by: sombochea
GPG Key ID: 3C7CF22A05D95490
2 changed files with 48 additions and 1 deletions

47
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,47 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: CI
on:
push:
branches: ['main']
pull_request:
branches: ['main']
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions/checkout@v3
- name: Build the Docker image
run: |
docker build . --file Dockerfile --tag registry.ctdn.net/spring-web-api:latest
docker push registry.ctdn.net/spring-web-api:latest
deploy:
runs-on: self-hosted
steps:
- name: Cloning repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Push to dokku
uses: dokku/github-action@master
with:
git_remote_url: 'ssh://dokku@heroku.ctdn.net:2222/spring-web-modules'
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
branch: main
git_push_flags: --force

View File

@ -6,6 +6,6 @@ APP_PROFILE=demo
VERSION=demo VERSION=demo
IMAGE=spring-web-api IMAGE=spring-web-api
CONTAINER=$IMAGE CONTAINER=$IMAGE
REGISTRY=registry.kh.cubetiqs.com REGISTRY=registry.ctdn.net
EXPOSE_PORT=8080 EXPOSE_PORT=8080
ROOT_HUB=$REGISTRY/$IMAGE:$VERSION ROOT_HUB=$REGISTRY/$IMAGE:$VERSION