feat: 사용자 구독 기능 구현 #62
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 video/src/main/resources/application-oauth.properties | |
touch video/src/main/resources/application-prod.properties | |
touch video/src/main/resources/application.properties | |
echo "${{ secrets.APPLICATION_PROD }}" > video/src/main/resources/application-prod.properties | |
echo "${{ secrets.APPLICATION_OAUTH }}" > video/src/main/resources/application-oauth.properties | |
echo "${{ secrets.APPLICATION_PROPERTIES }}" > video/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 video: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 |