Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
deveunhwa authored Nov 6, 2024
2 parents 508e99a + c6ee8cd commit 8e07579
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 16 deletions.
25 changes: 19 additions & 6 deletions .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,21 @@ jobs:
# 새 컨테이너 실행
docker stop $TARGET_CONTAINER || true
docker rm $TARGET_CONTAINER || true
docker run -d --name $TARGET_CONTAINER -p 8080:8080 \
-e SPRING_PROFILES_ACTIVE=prod \
-e AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} \
-e AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \
${{ secrets.DOCKER_USERNAME }}/bitta-kotlin:latest
# 조건문을 사용해 컨테이너에 맞는 포트로 실행
if [ "$TARGET_CONTAINER" == "backend-blue" ]; then
docker run -d --name backend-blue -p 8081:8080 \
-e SPRING_PROFILES_ACTIVE=prod \
-e AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} \
-e AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \
${{ secrets.DOCKER_USERNAME }}/bitta-kotlin:latest
else
docker run -d --name backend-green -p 8082:8080 \
-e SPRING_PROFILES_ACTIVE=prod \
-e AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} \
-e AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \
${{ secrets.DOCKER_USERNAME }}/bitta-kotlin:latest
fi
# Nginx 리로드하여 트래픽 전환
sudo systemctl reload nginx
Expand All @@ -103,5 +113,8 @@ jobs:
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd ~/bitta-project
docker-compose down
docker-compose up -d
docker-compose up -d --no-deps
sudo nginx -s reload
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM openjdk:17-jdk-alpine
WORKDIR /app

# Copy the built jar file
COPY build/libs/*.jar app.jar
COPY build/libs/*.jar /app.jar

# Set the entry point to run the application
EXPOSE 8080
Expand Down
28 changes: 19 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
version: '3'
services:
frontend-blue:
image: publicdeveh/bitta-front:latest
ports:
- "3001:3000"
environment:
- NODE_ENV=production

frontend-green:
image: publicdeveh/bitta-front:latest
ports:
- "3002:3000"
environment:
- NODE_ENV=production

backend-blue:
build:
context: .
dockerfile: Dockerfile
image: publicdeveh/bitta-kotlin:latest
ports:
- "8081:8080"
- "8081:8000"
environment:
- SPRING_PROFILES_ACTIVE=prod

backend-green:
build:
context: .
dockerfile: Dockerfile
image: publicdeveh/bitta-kotlin:latest
ports:
- "8082:8080"
- "8082:8000"
environment:
- SPRING_PROFILES_ACTIVE=prod
- SPRING_PROFILES_ACTIVE=prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.tenten.bittakotlin.feedInteraction.feedLike.dto

data class FeedLikeDTO(
val feedId: Long?,
val profileId: Long?,
val isLiked: Boolean
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.tenten.bittakotlin.feedInteraction.feedLike.service

import org.tenten.bittakotlin.feedInteraction.feedLike.dto.FeedLikeDTO

interface FeedLikeService {
fun toggleLike(feedId: Long, profileId: Long): FeedLikeDTO
fun getLikeCount(feedId: Long): Long
}

0 comments on commit 8e07579

Please sign in to comment.