-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (45 loc) · 1.47 KB
/
deploy.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
name: TIFY CI/CD
on:
push:
branches: [ "dev", "main" ]
permissions:
contents: read
jobs:
build:
name: TIFY CI/CD
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup jdk-17
uses: actions/setup-java@main
with:
java-version: 17
distribution: 'zulu'
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Docker build
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }} .
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:latest
# AWS EC2 Server Connect & Docker 명령어 실행
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.AWS_HOST }}
username: ubuntu
key: ${{ secrets.AWS_KEY }}
timeout: 60s
# 도커 작업
script: |
cd ~/srv
sh ~/srv/ubuntu/config/scripts/docker-init.sh
sudo rm concal.log
sudo docker rm - f $(docker ps -qa)
sudo docker-compose pull
sudo docker stop $(docker ps -a -q)
sudo docker-compose -f docker-compose.test.yml up -d
sudo docker logs -f backend &> concal.log &
sudo docker image prune -f