Skip to content

Update README.md

Update README.md #169

Workflow file for this run

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