Skip to content

chore: 테스트용 페이지 추가 #66

chore: 테스트용 페이지 추가

chore: 테스트용 페이지 추가 #66

Workflow file for this run

name: Java CI/CD with Gradle
on:
push:
branches: [ "CHAT-63-DevOps-ToolChain" ]
pull_request:
branches: [ "CHAT-63-DevOps-ToolChain" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
run: ./gradlew --warning-mode all build -i
docker-build:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Grant execute permisson for gradlew
run: chmod +x gradlew
- name: Build with Gradle (without Test)
run: ./gradlew clean build -x test --stacktrace
- name: Docker Hub build & push
run: |
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_PWD }}
docker build -t chatdiary/chatdiary-image:latest .
docker images
docker push chatdiary/chatdiary-image:latest
- name: deploy
uses: appleboy/ssh-action@master
with:
username: ec2-user
host: ${{ secrets.HOST }}
key: ${{ secrets.PRIVATE_KEY }}
port: ${{secrets.PORT}}
script: |
sudo docker ps
sudo docker pull chatdiary/chatdiary-image:latest
sudo docker run -d -p 8080:8080 chatdiary/chatdiary-image:latest
sudo docker image prune -f