fix/#172 관리자 모듈 분리에 따른 테스트 코드 개선 (#173) #53
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: Build and Deploy to Dev Server | |
on: | |
push: | |
branches: | |
- develop | |
workflow_dispatch: | |
jobs: | |
build-docker-image: | |
runs-on: ubuntu-latest | |
environment: dev | |
steps: | |
- name: get repo from github | |
uses: actions/checkout@v3 | |
# JDK setting | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
# gradle 빌드 | |
- name: Setup Gradle | |
run: chmod +x gradlew | |
- name: Build with Gradle Wrapper | |
run: | | |
./gradlew clean build -p aics-api -x test | |
./gradlew clean build -p aics-admin -x test | |
# DockerHub 로그인 | |
- name: Docker login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
# Docker 이미지 빌드 | |
- name: Docker image build for aics-api | |
run: | | |
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/aics-api:${{ github.sha }} -f aics-api/Dockerfile . | |
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/aics-api:${{ github.sha }} ${{ secrets.DOCKERHUB_USERNAME }}/aics-api:latest | |
- name: Docker image build for aics-admin | |
run: | | |
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/aics-admin:${{ github.sha }} -f aics-admin/Dockerfile . | |
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/aics-admin:${{ github.sha }} ${{ secrets.DOCKERHUB_USERNAME }}/aics-admin:latest | |
# Docker Hub 이미지 푸시 | |
- name: docker Hub push for aics-api | |
run: | | |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/aics-api:${{ github.sha }} | |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/aics-api:latest | |
- name: docker Hub push for aics-admin | |
run: | | |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/aics-admin:${{ github.sha }} | |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/aics-admin:latest | |
deploy-to-dev: | |
runs-on: ubuntu-latest | |
needs: build-docker-image | |
environment: dev | |
steps: | |
- name: SSH to server and deploy | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
password: ${{ secrets.SERVER_PASSWORD }} | |
port: ${{ secrets.SERVER_PORT }} | |
script: | | |
echo "${{ secrets.SERVER_PASSWORD }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }} pull aics-api | |
echo "${{ secrets.SERVER_PASSWORD }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }} pull aics-admin | |
echo "${{ secrets.SERVER_PASSWORD }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }} up -d aics-api | |
echo "${{ secrets.SERVER_PASSWORD }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }} up -d aics-admin |