-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (76 loc) · 2.82 KB
/
aws.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
# Spring Boot 애플리케이션을 빌드하여 도커허브에 푸시하는 과정
build-docker-image:
runs-on: ubuntu-latest
environment: video-share
steps:
- uses: actions/checkout@v3
# 1. Java 17 세팅
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
# 2. Spring Boot 애플리케이션 빌드
- name: Build with Gradle
run: |
touch app/src/main/resources/application-oauth.properties
touch app/src/main/resources/application-prod.properties
touch app/src/main/resources/application.properties
echo "${{ secrets.APPLICATION_PROD }}" > app/src/main/resources/application-prod.properties
echo "${{ secrets.APPLICATION_OAUTH }}" > app/src/main/resources/application-oauth.properties
echo "${{ secrets.APPLICATION_PROPERTIES }}" > app/src/main/resources/application.properties
echo "${{ secrets.UTILL_APPLICATION_PROPERTIES }}" > util/src/main/resources/application.properties
cat util/src/main/resources/application.properties
chmod +x gradlew
./gradlew clean app:build --exclude-task test
ls
pwd
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/streaming:latest .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/streaming:latest
cd live-streamming
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/nginx-rtmp:ssl .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/nginx-rtmp:ssl
- name: Transfer files to EC2
uses: appleboy/scp-action@master
with:
host: ${{ secrets.EC2_IP }}
username: ubuntu
key: ${{ secrets.SSH_PRIVATE_KEY }}
source: .
target: app
- name: SSH into EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_IP }}
username: ubuntu
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd app
sudo docker compose down
sudo docker compose pull
sudo docker rm -f $(sudo docker ps -qa)
sudo cp -r ../video-streaming/data ./
pwd
ls
pwd
sudo docker pull van133/streaming
sudo docker pull van133/nginx-rtmp:ssl
#sudo docker-compose build
#sudo sh ./init-letsencrypt.sh
sudo docker compose up -d
sudo docker image prune --all --force