Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
13 commits
Select commit Hold shift + click to select a range
ecbf170
feat: pass ์—”ํ‹ฐํ‹ฐ์— ๊ฐ•๋„์™€ ์šด๋™ ๋ชฉ์  ํ•„๋“œ ์ถ”๊ฐ€
zzuhannn Nov 13, 2025
979e69e
refactor: ํ‰์  ํ•„๋“œ ๋ฐ ๊ด€๋ จ ๋ฉ”์†Œ๋“œ ์ œ๊ฑฐ
zzuhannn Nov 13, 2025
207c8cd
fix: Pass viewCount ํ•„๋“œ์— @Builder.Default ์ถ”๊ฐ€
zzuhannn Nov 13, 2025
c23de34
feat: ๋”๋ฏธ๋ฐ์ดํ„ฐ ์ƒ์„ฑ
zzuhannn Nov 13, 2025
f9a47af
feat: fastAPI ์„œ๋ฒ„์—์„œ db์— ์กด์žฌํ•˜๋Š” pass ์กฐํšŒ ์„œ๋น„์Šค ๋กœ์ง ์ถ”๊ฐ€
zzuhannn Nov 13, 2025
072b562
feat: fastAPI ์„œ๋ฒ„์—์„œ db์— ์กด์žฌํ•˜๋Š” pass ์กฐํšŒ ์—”๋“œํฌ์ธํŠธ ์ถ”๊ฐ€
zzuhannn Nov 13, 2025
f690b6a
feat: ์ „์ฒด ํŒจํ‚ค์ง€ ์กฐํšŒ ๋ฐ˜ํ™˜ dto ์ถ”๊ฐ€
zzuhannn Nov 13, 2025
4573178
feat: securityConfig์— permitAll ์—”๋“œํฌ์ธํŠธ ์ถ”๊ฐ€
zzuhannn Nov 13, 2025
6c30871
feat: AI๋ฅผ ์ด์šฉํ•ด์„œ ์„ค๋ฌธ ๊ธฐ๋ฐ˜ ํŒจํ‚ค์ง€ ์ถ”์ฒœ ๋กœ์ง ์ถ”๊ฐ€
zzuhannn Nov 13, 2025
921fba5
feat: RestTemplate ์„ค์ • ํŒŒ์ผ ์ถ”๊ฐ€
zzuhannn Nov 13, 2025
5a5a8e7
feat: AI ๊ธฐ๋ฐ˜ ํŒจํ‚ค์ง€ ์ถ”์ฒœ ์‹œ์Šคํ…œ ์ถ”๊ฐ€ ๋ฐ ๋ฐฐํฌ ์„ค์ • ์™„๋ฃŒ
zzuhannn Nov 13, 2025
643bdb2
chore: README.md ์—…๋ฐ์ดํŠธ
zzuhannn Nov 13, 2025
951f4ca
Merge branch 'main' into feat/api-AiRecommendPass
zzuhannn Nov 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 28 additions & 13 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
env:
IMAGE_NAME: mov-api
SPRING_IMAGE_NAME: mov-api
FASTAPI_IMAGE_NAME: mov-fastapi
steps:
- name: Deploy to EC2
uses: appleboy/ssh-action@master
Expand All @@ -24,27 +25,41 @@ jobs:
script: |
# ็’ฐๅขƒ ๋ณ€์ˆ˜ ์„ค์ •
DOCKER_USERNAME=${{ secrets.DOCKERHUB_USERNAME }}
IMAGE_NAME=${{ env.IMAGE_NAME }}
CONTAINER_NAME=mov-api
SPRING_IMAGE_NAME=${{ env.SPRING_IMAGE_NAME }}
FASTAPI_IMAGE_NAME=${{ env.FASTAPI_IMAGE_NAME }}
SPRING_CONTAINER_NAME=mov-api
FASTAPI_CONTAINER_NAME=mov-fastapi
ENV_FILE_PATH=/home/${{ secrets.EC2_USERNAME }}/.env

echo "CI/CD: [1/5] Creating .env file..."
echo "CI/CD: [1/8] Creating .env file..."
echo "${{ secrets.ENV_FILE }}" > $ENV_FILE_PATH

echo "CI/CD: [2/5] Pulling latest Docker image..."
docker pull $DOCKER_USERNAME/$IMAGE_NAME:latest
echo "CI/CD: [2/8] Pulling latest Spring Boot Docker image..."
docker pull $DOCKER_USERNAME/$SPRING_IMAGE_NAME:latest

echo "CI/CD: [3/5] Stopping and removing existing container..."
docker stop $CONTAINER_NAME || true
docker rm $CONTAINER_NAME || true
echo "CI/CD: [3/8] Stopping and removing existing Spring Boot container..."
docker stop $SPRING_CONTAINER_NAME || true
docker rm $SPRING_CONTAINER_NAME || true

echo "CI/CD: [4/5] Starting new container..."
docker run -d --name $CONTAINER_NAME \
echo "CI/CD: [4/8] Starting new Spring Boot container..."
docker run -d --name $SPRING_CONTAINER_NAME \
--env-file $ENV_FILE_PATH \
-p 8080:8080 \
$DOCKER_USERNAME/$IMAGE_NAME:latest
$DOCKER_USERNAME/$SPRING_IMAGE_NAME:latest

echo "CI/CD: [5/5] Cleaning up unused images..."
echo "CI/CD: [5/8] Pulling latest FastAPI Docker image..."
docker pull $DOCKER_USERNAME/$FASTAPI_IMAGE_NAME:latest

echo "CI/CD: [6/8] Stopping and removing existing FastAPI container..."
docker stop $FASTAPI_CONTAINER_NAME || true
docker rm $FASTAPI_CONTAINER_NAME || true

echo "CI/CD: [7/8] Starting new FastAPI container..."
docker run -d --name $FASTAPI_CONTAINER_NAME \
-p 8000:8000 \
$DOCKER_USERNAME/$FASTAPI_IMAGE_NAME:latest

echo "CI/CD: [8/8] Cleaning up unused images..."
docker image prune -f

echo "CI/CD: Deployment complete."
29 changes: 25 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ on:
branches: [ "main" ]
workflow_dispatch: # Actions ํƒญ์—์„œ ์ˆ˜๋™ ์‹คํ–‰ ๋ฒ„ํŠผ ์ œ๊ณต(ํ•„์š”ํ•  ๋•Œ ์ˆ˜๋™์œผ๋กœ ๋Œ๋ฆด ์ˆ˜ ์žˆ๊ฒŒ)
env:
IMAGE_NAME: mov-api
SPRING_IMAGE_NAME: mov-api
FASTAPI_IMAGE_NAME: mov-fastapi

jobs:
build-and-push:
build-spring-boot:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -22,10 +23,30 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and conditionally push Docker image
- name: Build and conditionally push Spring Boot Docker image
uses: docker/build-push-action@v4
with:
context: .
# main ๋ธŒ๋žœ์น˜์— push๋  ๋•Œ๋งŒ Docker Hub์— ์ด๋ฏธ์ง€๋ฅผ ํ‘ธ์‹œํ•ฉ๋‹ˆ๋‹ค.
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.SPRING_IMAGE_NAME }}:latest

build-fastapi:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and conditionally push FastAPI Docker image
uses: docker/build-push-action@v4
with:
context: ./ai_recommendation
# main ๋ธŒ๋žœ์น˜์— push๋  ๋•Œ๋งŒ Docker Hub์— ์ด๋ฏธ์ง€๋ฅผ ํ‘ธ์‹œํ•ฉ๋‹ˆ๋‹ค.
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.FASTAPI_IMAGE_NAME }}:latest
34 changes: 34 additions & 0 deletions ai_recommendation/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Python
venv/
__pycache__/
*.pyc
*.pyo
*.pyd
.Python
*.so
*.egg
*.egg-info/
dist/
build/

# IDE
.vscode/
.idea/
*.swp
*.swo

# OS
.DS_Store
Thumbs.db

# Git
.git/
.gitignore

# Testing
.pytest_cache/
.coverage
htmlcov/

# Logs
*.log
55 changes: 55 additions & 0 deletions ai_recommendation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
*.egg
*.egg-info/
dist/
build/
*.whl

# Virtual Environment
venv/
env/
ENV/
.venv

# IDE
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store

# Jupyter Notebook
.ipynb_checkpoints

# Testing
.pytest_cache/
.coverage
htmlcov/
*.cover
.hypothesis/

# Logs
*.log
logs/

# Environment variables
.env
.env.local

# Model files (์„ ํƒ์  - ํ•™์Šต๋œ ๋ชจ๋ธ์„ Git์—์„œ ์ œ์™ธํ•˜๋ ค๋ฉด ์ฃผ์„ ํ•ด์ œ)
# models/*.cbm
# models/*.pkl

# Data files (์„ ํƒ์  - ๋Œ€์šฉ๋Ÿ‰ ๋ฐ์ดํ„ฐ๋ฅผ ์ œ์™ธํ•˜๋ ค๋ฉด ์ฃผ์„ ํ•ด์ œ)
# data/*.csv
# data/*.json

# Temporary files
*.tmp
*.bak
*.cache
22 changes: 22 additions & 0 deletions ai_recommendation/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# FastAPI ์ถ”์ฒœ ์‹œ์Šคํ…œ Docker ์ด๋ฏธ์ง€
FROM python:3.9-slim

WORKDIR /app

# ์‹œ์Šคํ…œ ํŒจํ‚ค์ง€ ์—…๋ฐ์ดํŠธ ๋ฐ ํ•„์ˆ˜ ๋„๊ตฌ ์„ค์น˜
RUN apt-get update && apt-get install -y \
gcc \
&& rm -rf /var/lib/apt/lists/*

# Python ์˜์กด์„ฑ ์„ค์น˜
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ฝ”๋“œ ๋ณต์‚ฌ
COPY . .

# ํฌํŠธ ๋…ธ์ถœ
EXPOSE 8000

# FastAPI ์„œ๋ฒ„ ์‹คํ–‰
CMD ["uvicorn", "api.server:app", "--host", "0.0.0.0", "--port", "8000"]
Loading