-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from LminWoo99/develop
Develop
- Loading branch information
Showing
2 changed files
with
77 additions
and
77 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,76 @@ | ||
name: CD | ||
|
||
on: | ||
push: | ||
branches: [ "master"] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
|
||
|
||
- name: make application-prod.yml | ||
run: | | ||
cd ./src/main/resources | ||
touch ./application.yml | ||
echo "${{ secrets.APPLICATION_PROD }}" > ./application.yml | ||
- name: make application-prod.yaml | ||
run: | | ||
cd ./src/main/resources | ||
touch ./application.yaml | ||
echo "${{ secrets.APPLICATION_PRO }}" > ./application.yaml | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build -x test | ||
|
||
- name: Docker build | ||
run: | | ||
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
docker buildx build --push --platform linux/amd64 -t ${{ secrets.DOCKER_USERNAME }}/chat . | ||
# docker tag chat ${{ secrets.DOCKER_USERNAME }}/chat | ||
docker push ${{ secrets.DOCKER_USERNAME }}/chat | ||
- name: Deploy | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ec2-user | ||
key: ${{ secrets.PRIVATE_KEY }} # pem 키 | ||
script: | | ||
docker pull ${{ secrets.DOCKER_USERNAME }}/chat | ||
docker stop $(docker ps -a -q | grep -v $(docker-compose ps -q kurento)) # Kurento 서비스를 제외한 다른 모든 컨테이너 중지 | ||
docker rm $(docker ps --filter 'status=exited' -a -q) # 종료된(exited) 상태의 모든 컨테이너 삭제 | ||
docker-compose up -d | ||
docker image prune -a -f | ||
- name: Deploy to Instance | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ec2-user | ||
key: ${{ secrets.PRIVATE_KEY }} | ||
|
||
script: | | ||
docker pull ${{ secrets.DOCKER_USERNAME }}/chat | ||
docker stop $(docker ps -a -q | grep -v $(docker-compose ps -q kurento)) # Kurento 서비스를 제외한 다른 모든 컨테이너 중지 | ||
docker rm $(docker ps --filter 'status=exited' -a -q) # 종료된(exited) 상태의 모든 컨테이너 삭제 | ||
docker-compose up -d | ||
docker image prune -a -f | ||
#name: CD | ||
# | ||
#on: | ||
# push: | ||
# branches: [ "master"] | ||
# pull_request: | ||
# branches: [ "master" ] | ||
# | ||
#permissions: | ||
# contents: read | ||
# | ||
#jobs: | ||
# build: | ||
# | ||
# runs-on: ubuntu-latest | ||
# | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# - name: Set up JDK 11 | ||
# uses: actions/setup-java@v3 | ||
# with: | ||
# java-version: '11' | ||
# distribution: 'temurin' | ||
# | ||
# | ||
# - name: make application-prod.yml | ||
# run: | | ||
# cd ./src/main/resources | ||
# touch ./application.yml | ||
# echo "${{ secrets.APPLICATION_PROD }}" > ./application.yml | ||
# - name: make application-prod.yaml | ||
# run: | | ||
# cd ./src/main/resources | ||
# touch ./application.yaml | ||
# echo "${{ secrets.APPLICATION_PRO }}" > ./application.yaml | ||
# | ||
# | ||
# - name: Grant execute permission for gradlew | ||
# run: chmod +x gradlew | ||
# | ||
# - name: Build with Gradle | ||
# run: ./gradlew build -x test | ||
# | ||
# - name: Docker build | ||
# run: | | ||
# docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
# docker buildx build --push --platform linux/amd64 -t ${{ secrets.DOCKER_USERNAME }}/chat . | ||
# # docker tag chat ${{ secrets.DOCKER_USERNAME }}/chat | ||
# docker push ${{ secrets.DOCKER_USERNAME }}/chat | ||
# | ||
# - name: Deploy | ||
# uses: appleboy/ssh-action@master | ||
# with: | ||
# host: ${{ secrets.HOST }} | ||
# username: ec2-user | ||
# key: ${{ secrets.PRIVATE_KEY }} # pem 키 | ||
# script: | | ||
# docker pull ${{ secrets.DOCKER_USERNAME }}/chat | ||
# docker stop $(docker ps -a -q | grep -v $(docker-compose ps -q kurento)) # Kurento 서비스를 제외한 다른 모든 컨테이너 중지 | ||
# docker rm $(docker ps --filter 'status=exited' -a -q) # 종료된(exited) 상태의 모든 컨테이너 삭제 | ||
# docker-compose up -d | ||
# docker image prune -a -f | ||
# | ||
# - name: Deploy to Instance | ||
# uses: appleboy/ssh-action@master | ||
# with: | ||
# host: ${{ secrets.HOST }} | ||
# username: ec2-user | ||
# key: ${{ secrets.PRIVATE_KEY }} | ||
# | ||
# script: | | ||
# docker pull ${{ secrets.DOCKER_USERNAME }}/chat | ||
# docker stop $(docker ps -a -q | grep -v $(docker-compose ps -q kurento)) # Kurento 서비스를 제외한 다른 모든 컨테이너 중지 | ||
# docker rm $(docker ps --filter 'status=exited' -a -q) # 종료된(exited) 상태의 모든 컨테이너 삭제 | ||
# docker-compose up -d | ||
# docker image prune -a -f |
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