refactor : change port #2
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: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build-docker-image: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# 1. Java 17 세팅 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
# 2. Spring Boot 애플리케이션 빌드 | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: clean bootJar | |
# 3. Docker 이미지 빌드 | |
- name: docker image build | |
run: docker buildx build --platform=linux/arm64 -t ${{ secrets.DOCKERHUB_USERNAME }}/attachit:latest . | |
# 4. Dockerhub 로그인 | |
- name: docker login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# 5. Dockerhub push | |
- name: docker hub push | |
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/attachit:latest | |
- name: Connect to WAS & Execute Application | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.WAS_HOST }} | |
username: ${{ secrets.WAS_USERNAME }} | |
password: ${{ secrets.SSH_PASSWORD }} | |
port: ${{ secrets.WAS_SSH_PORT }} | |
script: | | |
cd ~/attachit | |
docker-compose down | |
docker-compose pull | |
docker-compose up -d |