fix/#23: test시 RestDocumentationResultHandler NoSuchBean 에러 해결 #33
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: Deploy To EC2 | |
on: | |
push: | |
branches: | |
- Chore/#23 | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Github Repository 파일 불러오기 | |
uses: actions/checkout@v4 | |
- name: JDK 17버전 설치 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: application-secret.yml 파일 만들기 | |
run: echo "${{ secrets.APPLICATION_SECRET }}" > ./src/main/resources/application-secret.yml | |
- name: 테스트 및 빌드하기 | |
run: ./gradlew clean build | |
- name: AWS Resource에 접근할 수 있게 AWS credentials 설정 | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: ap-northeast-2 | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: 도커 허브에 로그인 | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: API 서버 Docker 이미지 생성 | |
run: docker build -t dnd-server . | |
- name: nginx docker 이미지 생성 | |
run: docker build -t nginx ./nginx | |
- name: Docker 이미지에 Tag 붙이기 | |
run: | | |
docker tag dnd-server ${{ secrets.DOCKER_HUB_USERNAME }}/dnd-server:latest | |
docker tag nginx ${{ secrets.DOCKER_HUB_USERNAME }}/nginx:latest | |
- name: Docker Hub에 Docker 이미지 Push하기 | |
run: | | |
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/dnd-server:latest | |
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/nginx:latest | |
- name: Docker Compose 파일 업로드 | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.EC2_HOST }} | |
username: ${{ secrets.EC2_USERNAME }} | |
key: ${{ secrets.EC2_PRIVATE_KEY }} | |
source: ./docker-compose.yml | |
target: /home/ubuntu/docker-compose | |
- name: SSH로 EC2에 접속하여 Docker Compose 실행 | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.EC2_HOST }} | |
username: ${{ secrets.EC2_USERNAME }} | |
key: ${{ secrets.EC2_PRIVATE_KEY }} | |
script_stop: true | |
script: | | |
export REGISTRY_URL=${{ secrets.DOCKER_HUB_USERNAME }} | |
docker-compose -f /home/ubuntu/docker-compose/docker-compose.yml down || true | |
docker-compose -f /home/ubuntu/docker-compose/docker-compose.yml pull | |
docker-compose -f /home/ubuntu/docker-compose/docker-compose.yml up -d |