From 5b5494108c1fff13e4f5339fca56110091d638d3 Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Mon, 3 Oct 2022 08:35:12 +0700 Subject: [PATCH] Add ci build and deploy --- .github/workflows/ci.yml | 47 ++++++++++++++++++++++++++++++++++++++++ apps/demo/variable.sh | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4527fad --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/apps/demo/variable.sh b/apps/demo/variable.sh index e139f12..cb7db04 100644 --- a/apps/demo/variable.sh +++ b/apps/demo/variable.sh @@ -6,6 +6,6 @@ APP_PROFILE=demo VERSION=demo IMAGE=spring-web-api CONTAINER=$IMAGE -REGISTRY=registry.kh.cubetiqs.com +REGISTRY=registry.ctdn.net EXPOSE_PORT=8080 ROOT_HUB=$REGISTRY/$IMAGE:$VERSION \ No newline at end of file