-
Notifications
You must be signed in to change notification settings - Fork 2
51 lines (43 loc) · 1.47 KB
/
be-cd.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
name: Coduo Backend CD
on:
push:
branches: ["BE/main"]
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend
steps:
- name: checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
- name: Make prod application.yml
run: |
rm -rf ./src/main/resources/application.yml
touch ./src/main/resources/application.yml
echo ${{ secrets.BE_PROD_YML }} | base64 --decode > ./src/main/resources/application.yml
shell: bash
- name: Grant Execute Permission For Gradlew
run: chmod +x gradlew
- name: Build With Gradle
run: ./gradlew build -x test
- name: Docker build & Push
run: |
docker login -u ${{ secrets.DOCKER_HUB_ID }} -p ${{ secrets.DOCKER_HUB_PASSWORD }}
docker buildx build --platform=linux/arm64 -t ${{ secrets.DOCKER_HUB_REPO }}/springboot-app .
docker push ${{ secrets.DOCKER_HUB_REPO }}/springboot-app
deploy:
needs: build
runs-on: coduo-backend-ec2
steps:
- name: Deploy Images with Docker compose
run: |
docker-compose -f ~/docker-compose.yml down
docker rmi -f ${{ secrets.DOCKER_HUB_REPO }}/springboot-app
docker pull ${{ secrets.DOCKER_HUB_REPO }}/springboot-app
docker-compose -f ~/docker-compose.yml up -d