-
Notifications
You must be signed in to change notification settings - Fork 7
61 lines (49 loc) Β· 1.63 KB
/
deploy-be-ci-cd-push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: All deploy CI + CD on push
on:
push:
branches: [ "deploy/BE" ]
jobs:
deploy-ci:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.SUBMODULE_BE_TOKEN }}
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
- name: Build with Gradle
uses: gradle/[email protected]
- name: Execute Gradle build
run: |
cd backend/baton
./gradlew build
- name: Setup Docker buildx
uses: docker/[email protected]
- name: Login to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_DEPLOY_USERNAME }}
password: ${{ secrets.DOCKERHUB_DEPLOY_TOKEN }}
- name: Docker Image Build
run: |
cd backend/baton
docker build --platform linux/arm64/v8 -t 2023batondeploy/2023-baton-deploy -f Dockerfile-deploy .
- name: Docker Hub Push
run: docker push 2023batondeploy/2023-baton-deploy
deploy-cd:
needs: deploy-ci
runs-on: [self-hosted, Linux, ARM64, deploy]
steps:
- name: Pull Latest Docker Image
run: |
sudo docker login --username ${{ secrets.DOCKERHUB_DEPLOY_USERNAME }} --password ${{ secrets.DOCKERHUB_DEPLOY_TOKEN }}
sudo docker pull 2023batondeploy/2023-baton-deploy:latest
- name: Docker Compose
run: |
/home/ubuntu/zero-downtime-deploy.sh
sudo docker image prune -af