Skip to content

Refactor: properties 수정 #23

Refactor: properties 수정

Refactor: properties 수정 #23

Workflow file for this run

name: Deploy To EC2
on:
push:
branches:
- main
- dev
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Github Repository에 올린 파일들을 불러오기
uses: actions/checkout@v4
- name: JDK 21 버전 설치
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: 테스트 및 빌드하기
run: |
chmod +x ./gradlew
./gradlew clean build -x test
- name: Docker Hub에 로그인하기
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Docker 이미지 생성
run: docker build -t nullnull-server . \
-e REDIRECT_URL=${{ secrets.REDIRECT_URL }}
- name: Docker 이미지에 Tag 붙이기
run: docker tag nullnull-server ${{ secrets.DOCKERHUB_USERNAME }}/nullnull-server:latest
- name: Docker Hub에 Docker 이미지 Push하기
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/nullnull-server:latest
- name: SSH로 EC2에 접속하기
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}
script_stop: true
script: |
docker stop nullnull-server || true
docker rm nullnull-server || true
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/nullnull-server:latest
docker run -d --name nullnull-server -p 8080:8080 ${{ secrets.DOCKERHUB_USERNAME }}/nullnull-server:latest