-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat : server와 DB용 docker compose 추가 * fix : 윈도우에서 makeGitHooksExecutable 에러 fix * feat : docker-compose 타임존 추가 * feat : dockerfile 구현 * feat : dockerfile 구현 * remove : docker 파일 server-docker 폴더로 위치 이동 * refactor : docker 이미지에 맞는 컨테이너 이름으로 변경 * feat : 서버 애플리케이션 docker 이미지 생성을 위한 dockerfile 추가 * fix: 기존의 h2인메모리 드라이버와 mysql 드라이버 충돌 해결 * fix: openjdk 이미지 사용 * fix: dockerfile 사용해서 서버 이미지 빌드 * docs : docker db gitignore 추가 * docs : 삭제된 p6spy 추가 * fix : mysql 컨테이너가 준비되기 전 server 컨테이너 동작 지연 * refactor: renaming containers * feat: 도커 파일에 빌드 스테이지 추가 * build: 기존 도커파일 삭제 * build: 개발용 도커파일 재정의 * build: docker-compose up --build를 통해 gradle 빌드까지 수행하도록 개선 * chore: gitignore shell script 파일 추가 --------- Co-authored-by: Minseong Park <[email protected]> Co-authored-by: Minseong Park <[email protected]>
- Loading branch information
1 parent
36ae2b3
commit 8f4dfe7
Showing
5 changed files
with
87 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM gradle:7.4-jdk17 | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
CMD ["./gradlew", ":application:bootRun"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# docker-compose.yml | ||
|
||
services: | ||
mysql: | ||
container_name: spot-mysql | ||
image: mysql:8 # 선호하는 버전 있을 경우 선정 예정! | ||
ports: | ||
- 3306:3306 # 혹시나 기존에 MySQL 사용 중일 경우 앞자리를 다른 포트로 바꿔야함. | ||
volumes: | ||
- ./db/mysql/data:/var/lib/mysql # 기존 데이터 파일과 격리를 위해 db/mysql/data 로 설정함! | ||
command: | ||
- '--character-set-server=utf8mb4' | ||
- '--collation-server=utf8mb4_unicode_ci' | ||
environment: | ||
TZ : "Asia/Seoul" | ||
MYSQL_ROOT_PASSWORD: test1234 # 임시 비밀번호 | ||
MYSQL_DATABASE: spot # DB 이름 선정 시 변경 예정. | ||
MYSQL_USER: test1234 # 임시 유저 | ||
MYSQL_PASSWORD: test1234 # 임시 비밀번호 | ||
healthcheck: # MySQL 서비스 상태 확인 | ||
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"] | ||
timeout: 20s | ||
retries: 10 | ||
|
||
server: | ||
build: # 디렉토리에 있는 도커파일 이용해서 이미지 빌드 | ||
context: . | ||
dockerfile: Dockerfile.dev | ||
container_name: spot-spring-server | ||
ports: | ||
- 8080:8080 | ||
depends_on: # 항상 mysql 실행하고 서버 실행되게 함. | ||
mysql: | ||
condition: service_healthy # mysql 컨테이너의 healthcheck가 정상일 때까지 대기! | ||
environment: | ||
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/spot | ||
SPRING_DATASOURCE_USERNAME: test1234 | ||
SPRING_DATASOURCE_PASSWORD: test1234 | ||
volumes: | ||
- ./:/app | ||
- ~/.gradle:/root/.gradle | ||
command: ./gradlew :application:bootRun |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 29 additions & 16 deletions
45
infrastructure/jpa/src/main/resources/application-jpa.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,37 @@ | ||
spring: | ||
datasource: | ||
driver-class-name: org.h2.Driver | ||
url: jdbc:h2:mem:spot | ||
username: sa | ||
password: | ||
url: jdbc:mysql://mysql:3306/spot | ||
username: test1234 | ||
password: test1234 | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
|
||
jpa: | ||
database: h2 | ||
database: mysql | ||
database-platform: org.hibernate.dialect.MySQL8Dialect | ||
hibernate: | ||
ddl-auto: create | ||
database-platform: org.hibernate.dialect.H2Dialect | ||
open-in-view: false | ||
defer-datasource-initialization: true | ||
ddl-auto: update # 주의: 프로덕션 환경에서는 'validate' 사용 권장 | ||
show-sql: true | ||
properties: | ||
hibernate: | ||
format_sql: true | ||
use_sql_comments: true | ||
|
||
h2: | ||
console: | ||
enabled: true | ||
path: /h2-console | ||
sql: | ||
init: | ||
mode: always # 필요한 경우 'never'로 변경 | ||
|
||
server: | ||
port: 8080 | ||
|
||
logging: | ||
level: | ||
org.hibernate.SQL: DEBUG | ||
org.hibernate.type.descriptor.sql.BasicBinder: TRACE | ||
|
||
decorator: | ||
datasource: | ||
p6spy: | ||
enable-logging: true | ||
datasource: | ||
p6spy: | ||
enable-logging: true | ||
|
||
# 필요한 경우 추가 설정 | ||
|