Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
43 changes: 43 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CD

on:
push:
branches:
- main # main ๋ธŒ๋žœ์น˜ push ์‹œ ์ž๋™ ๋ฐฐํฌ
workflow_dispatch: # ์ˆ˜๋™ ์‹คํ–‰

permissions:
contents: read

env:
IMAGE: ${{ secrets.DOCKER_USERNAME }}/leftoversflirting

jobs:
deploy:
name: Deploy to Server
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

# SSH๋กœ ์„œ๋ฒ„์— ์ ‘์†ํ•ด ๋ฐฐํฌ
- name: Deploy over SSH
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
port: 22
script: |
echo "[1/3] Pull latest Docker image..."
docker pull ${{ env.IMAGE }}:latest

echo "[2/3] Restart container with new image..."
docker stop leftoversflirting || true
docker rm leftoversflirting || true
docker run -d --name leftoversflirting \
-p 8080:8080 \
${{ env.IMAGE }}:latest

echo "[3/3] Cleanup unused images..."
docker image prune -f
68 changes: 68 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI with Gradle

on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
workflow_dispatch:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

env:
JAVA_VERSION: '21'
IMAGE: ${{ secrets.DOCKER_USERNAME }}/leftoversflirting

jobs:
build: # 1) ๋นŒ๋“œ ์ „์šฉ Job โ€” PR๊ณผ push ๋ชจ๋‘ ์‹คํ–‰
name: Build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Temurin JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build JAR
run: ./gradlew bootJar -x test --no-daemon

docker-push:
name: Docker Build & Push
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build & Push image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
${{ env.IMAGE }}:latest
${{ env.IMAGE }}:${{ github.sha }}
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM eclipse-temurin:21-jre
WORKDIR /app
COPY build/libs/*.jar /app/app.jar
ENTRYPOINT ["java","-jar","/app/app.jar"]

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.example.Centralthon.domain.menu.service;

import com.example.Centralthon.domain.menu.entity.Menu;
import com.example.Centralthon.domain.menu.exception.MenuNotFoundException;
import com.example.Centralthon.domain.menu.repository.MenuRepository;
import com.example.Centralthon.domain.menu.web.dto.NearbyMenusRes;
import com.example.Centralthon.global.util.geo.BoundingBox;
Expand Down