fix : remove plain jar file, add user.html #57
Workflow file for this run
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
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: Docker Login | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_PWD }} | |
- name: Set up Docker | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: Dockerfile | |
push: true | |
tags: chatdiary/chatdiary-image:latest | |
- name: Build Docker Image | |
run: | | |
docker build -t chatdiary/chatdiary-image:latest . | |
docker images | |
- name: Push Docker Image | |
run: docker push chatdiary/chatdiary-image:latest | |
- name: Execute deploy script | |
uses: appleboy/ssh-action@master | |
with: | |
username: ec2-user | |
host: ${{ secrets.HOST }} | |
key: ${{ secrets.PRIVATE_KEY }} | |
port: ${{secrets.PORT}} | |
script: | | |
sudo docker stop server | |
sudo docker run -d --name server -p 8080:8080 chatdiary/chatdiary-image:latest |