Skip to content

[Feat]: AI 서버 연동 로직 구현 (#35) #70

[Feat]: AI 서버 연동 로직 구현 (#35)

[Feat]: AI 서버 연동 로직 구현 (#35) #70

Workflow file for this run

name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build-docker-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash
- name: Lint
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: ktlintCheck
- name: create .env file
run: |
mkdir -p storage/db-core/src/main/resources
touch storage/db-core/src/main/resources/db-core.yml
echo "${{ secrets.DB_CORE_YML }}" > storage/db-core/src/main/resources/db-core.yml
- name: Build with Gradle
uses: gradle/gradle-build-action@v3
with:
arguments: clean build
- name: docker image build
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/mediscan .
- name: docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: docker Hub push
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/mediscan
run-docker-image-on-ec2:
needs: build-docker-image
runs-on: ubuntu-latest
steps:
- name: Deploy to prod
uses: appleboy/[email protected]
id: deploy-prod
if: contains(github.ref, 'main')
with:
host: ${{ secrets.HOST_DEV }}
username: ${{ secrets.USERNAME }}
port: 22
key: ${{ secrets.PRIVATE_KEY }}
script: |
sudo docker pull suretrea/${{ secrets.DOCKER_REPO_PROD }}
sudo docker stop mediscan 2>/dev/null || true
sudo docker rm mediscan 2>/dev/null || true
sudo docker run --name mediscan -d -p 80:8080 suretrea/${{ secrets.DOCKER_REPO_PROD }}
sudo docker system prune -f