Skip to content

Commit 5dfd5e2

Browse files
committed
Enable QA seed data by default
0 parents  commit 5dfd5e2

File tree

115 files changed

+4948
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+4948
-0
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.gradle/
2+
build/
3+
bin/
4+
.idea/
5+
*.iml
6+
.env
7+
*.md

.github/workflows/deploy.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy to EC2
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Docker Hub 로그인
16+
uses: docker/login-action@v3
17+
with:
18+
username: ${{ secrets.DOCKER_USERNAME }}
19+
password: ${{ secrets.DOCKER_PASSWORD }}
20+
21+
- name: 이미지 빌드 & Push
22+
run: |
23+
docker build -t ${{ secrets.DOCKER_USERNAME }}/nutrishare:latest .
24+
docker push ${{ secrets.DOCKER_USERNAME }}/nutrishare:latest
25+
26+
- name: EC2 배포
27+
uses: appleboy/ssh-action@v1.0.3
28+
with:
29+
host: ${{ secrets.EC2_HOST }}
30+
username: ${{ secrets.EC2_USER }}
31+
key: ${{ secrets.EC2_KEY }}
32+
script: |
33+
cd ~/Spring
34+
git pull origin master
35+
echo "DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }}" > .env.tmp
36+
cat .env >> .env.tmp && mv .env.tmp .env
37+
docker pull ${{ secrets.DOCKER_USERNAME }}/nutrishare:latest
38+
docker-compose up -d
39+
docker-compose ps

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Gradle
2+
.gradle/
3+
build/
4+
bin/
5+
6+
# IntelliJ IDEA
7+
.idea/
8+
*.iml
9+
*.ipr
10+
*.iws
11+
out/
12+
13+
# Environment variables (sensitive)
14+
.env
15+
16+
# OS
17+
.DS_Store
18+
Thumbs.db
19+
20+
# Logs
21+
*.log
22+
23+
# OMX
24+
.omx/

Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Stage 1: Build
2+
FROM eclipse-temurin:17-jdk AS builder
3+
WORKDIR /app
4+
5+
COPY gradlew .
6+
COPY gradle gradle
7+
COPY build.gradle .
8+
COPY settings.gradle .
9+
COPY src src
10+
11+
RUN chmod +x gradlew && ./gradlew bootJar -x test --no-daemon
12+
13+
# Stage 2: Runtime
14+
FROM eclipse-temurin:17-jre
15+
WORKDIR /app
16+
17+
COPY --from=builder /app/build/libs/*.jar app.jar
18+
19+
EXPOSE 8080
20+
21+
ENTRYPOINT ["java", "-jar", "app.jar"]

build.gradle

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
plugins {
2+
id 'java'
3+
id 'org.springframework.boot' version '3.2.1'
4+
id 'io.spring.dependency-management' version '1.1.4'
5+
}
6+
7+
group = 'com.nutrishare'
8+
version = '0.0.1-SNAPSHOT'
9+
10+
java {
11+
sourceCompatibility = '17'
12+
}
13+
14+
configurations {
15+
compileOnly {
16+
extendsFrom annotationProcessor
17+
}
18+
}
19+
20+
repositories {
21+
mavenCentral()
22+
}
23+
24+
dependencies {
25+
// Web
26+
implementation 'org.springframework.boot:spring-boot-starter-web'
27+
implementation 'org.springframework.boot:spring-boot-starter-validation'
28+
29+
// Data
30+
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
31+
runtimeOnly 'com.mysql:mysql-connector-j'
32+
33+
// Security
34+
implementation 'org.springframework.boot:spring-boot-starter-security'
35+
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
36+
37+
// Redis
38+
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
39+
40+
// JWT
41+
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
42+
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
43+
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
44+
45+
// Utilities
46+
compileOnly 'org.projectlombok:lombok'
47+
annotationProcessor 'org.projectlombok:lombok'
48+
49+
// Test
50+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
51+
testImplementation 'org.springframework.security:spring-security-test'
52+
53+
// QueryDSL
54+
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
55+
annotationProcessor "com.querydsl:querydsl-apt:5.0.0:jakarta"
56+
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
57+
annotationProcessor "jakarta.persistence:jakarta.persistence-api"
58+
59+
// Swagger
60+
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0'
61+
}
62+
63+
tasks.named('test') {
64+
useJUnitPlatform()
65+
}

docker-compose.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
services:
2+
db:
3+
image: mysql:8.0
4+
environment:
5+
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
6+
MYSQL_DATABASE: ${MYSQL_DATABASE}
7+
MYSQL_USER: ${MYSQL_USER}
8+
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
9+
ports:
10+
- "3306:3306"
11+
volumes:
12+
- mysql_data:/var/lib/mysql
13+
healthcheck:
14+
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD}"]
15+
interval: 10s
16+
timeout: 5s
17+
retries: 5
18+
19+
redis:
20+
image: redis:7-alpine
21+
ports:
22+
- "6379:6379"
23+
healthcheck:
24+
test: ["CMD", "redis-cli", "ping"]
25+
interval: 10s
26+
timeout: 5s
27+
retries: 5
28+
29+
app:
30+
image: ${DOCKER_USERNAME}/nutrishare:latest
31+
ports:
32+
- "8080:8080"
33+
environment:
34+
DB_URL: ${DB_URL}
35+
DB_USERNAME: ${DB_USERNAME}
36+
DB_PASSWORD: ${DB_PASSWORD}
37+
REDIS_HOST: ${REDIS_HOST}
38+
REDIS_PORT: ${REDIS_PORT}
39+
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
40+
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
41+
KAKAO_CLIENT_ID: ${KAKAO_CLIENT_ID}
42+
KAKAO_CLIENT_SECRET: ${KAKAO_CLIENT_SECRET}
43+
JWT_SECRET: ${JWT_SECRET}
44+
APP_QA_SEED_ENABLED: ${APP_QA_SEED_ENABLED:-false}
45+
depends_on:
46+
db:
47+
condition: service_healthy
48+
redis:
49+
condition: service_healthy
50+
51+
volumes:
52+
mysql_data:

gradle/wrapper/gradle-wrapper.jar

42.7 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)