docker copose
This commit is contained in:
5
Dockerfile
Normal file
5
Dockerfile
Normal file
@@ -0,0 +1,5 @@
|
||||
FROM adoptopenjdk:11-jdk-hotspot
|
||||
ARG JAR_FILE=build/libs/*.jar
|
||||
COPY ${JAR_FILE} oneul.jar
|
||||
|
||||
ENTRYPOINT ["java", "-Dspring.profiles.active=prod", "-jar", "/oneul.jar"]
|
||||
@@ -24,13 +24,14 @@ dependencies {
|
||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
|
||||
implementation 'org.springframework.session:spring-session-data-redis'
|
||||
// implementation 'org.springframework.session:spring-session-core'
|
||||
|
||||
|
||||
runtimeOnly 'com.h2database:h2'
|
||||
implementation 'org.springframework.session:spring-session-data-redis'
|
||||
implementation 'org.springframework.session:spring-session-core'
|
||||
|
||||
runtimeOnly 'mysql:mysql-connector-java'
|
||||
|
||||
compileOnly 'org.projectlombok:lombok'
|
||||
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
||||
|
||||
24
docker-compose.yml
Normal file
24
docker-compose.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
version: "3"
|
||||
services:
|
||||
oneul:
|
||||
build: .
|
||||
ports:
|
||||
- 8080:8080
|
||||
depends_on:
|
||||
- mysql
|
||||
- redis
|
||||
|
||||
mysql:
|
||||
image: mysql
|
||||
environment:
|
||||
MYSQL_DATABASE: oneul
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_ROOT_HOST: '%'
|
||||
ports:
|
||||
- 3306:3306
|
||||
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379:6379
|
||||
|
||||
@@ -4,11 +4,9 @@ import java.util.Optional;
|
||||
|
||||
import com.example.oneul.domain.user.domain.UserEntity;
|
||||
|
||||
import org.springframework.data.redis.core.RedisHash;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@RedisHash
|
||||
@Repository
|
||||
public interface UserCommandRepository extends CrudRepository<UserEntity, Long> {
|
||||
Optional<UserEntity> findByUsername(String username);
|
||||
|
||||
33
src/main/resources/application-local.yml
Normal file
33
src/main/resources/application-local.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: local
|
||||
jpa:
|
||||
properties:
|
||||
hibernate:
|
||||
show-sql: true
|
||||
ddl-auto: update
|
||||
hbm2ddl:
|
||||
auto: update
|
||||
format_sql: true
|
||||
datasource:
|
||||
url: jdbc:mysql://localhost:3306/onuel?serverTimezone=UTC&characterEncoding=UTF-8
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
username: root
|
||||
redis:
|
||||
host: localhost
|
||||
port: 6379
|
||||
|
||||
server:
|
||||
servlet:
|
||||
session:
|
||||
timeout: 60
|
||||
|
||||
logging:
|
||||
level:
|
||||
web: DEBUG
|
||||
org:
|
||||
hibernate:
|
||||
SQL: DEBUG
|
||||
|
||||
log-in-page: www.naver.com
|
||||
34
src/main/resources/application-prod.yml
Normal file
34
src/main/resources/application-prod.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: prod
|
||||
jpa:
|
||||
properties:
|
||||
hibernate:
|
||||
show-sql: true
|
||||
ddl-auto: update
|
||||
hbm2ddl:
|
||||
auto: update
|
||||
format_sql: true
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://mysql:3306/oneul?serverTimezone=UTC&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: root
|
||||
redis:
|
||||
host: redis
|
||||
port: 6379
|
||||
|
||||
server:
|
||||
servlet:
|
||||
session:
|
||||
timeout: 60
|
||||
|
||||
logging:
|
||||
level:
|
||||
web: DEBUG
|
||||
org:
|
||||
hibernate:
|
||||
SQL: DEBUG
|
||||
|
||||
log-in-page: www.naver.com
|
||||
@@ -1,30 +1,3 @@
|
||||
spring:
|
||||
jpa:
|
||||
properties:
|
||||
hibernate:
|
||||
show-sql: true
|
||||
ddl-auto: update
|
||||
hbm2ddl:
|
||||
auto: update
|
||||
format_sql: true
|
||||
datasource:
|
||||
url: jdbc:h2:tcp://localhost/~/test
|
||||
driver-class-name: org.h2.Driver
|
||||
username: "sa"
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
|
||||
server:
|
||||
servlet:
|
||||
session:
|
||||
timeout: 60
|
||||
|
||||
logging:
|
||||
level:
|
||||
web: DEBUG
|
||||
org:
|
||||
hibernate:
|
||||
SQL: DEBUG
|
||||
|
||||
log-in-page: www.naver.com
|
||||
profiles:
|
||||
active: local
|
||||
Reference in New Issue
Block a user