加上容器化
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
# .env
|
||||
DATA_DIR=/srv/dev-disk-by-uuid-0c76cdc9-484e-45a6-9283-49e75e12eece/dockerApp/ReDiveClanBattleRecordBackend
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
# 使用 Kotlin + JDK 的輕量化映像
|
||||
FROM gradle:7.5.1-jdk17-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN gradle clean shadowJar --no-daemon
|
||||
|
||||
# 運行階段
|
||||
FROM eclipse-temurin:21-jdk-ubi10-minimal
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/build/libs/*.jar app.jar
|
||||
|
||||
CMD ["java", "-jar", "app.jar", "com.ray650128.pcredive.ApplicationKt"]
|
||||
@@ -0,0 +1,11 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
app:
|
||||
build: .
|
||||
container_name: clan-battle-record-backend
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- ${DATA_DIR}:/app/data
|
||||
restart: always
|
||||
@@ -7,7 +7,7 @@ import org.litote.kmongo.*
|
||||
import org.litote.kmongo.id.toId
|
||||
|
||||
object MemberRecordService {
|
||||
private val client = KMongo.createClient("mongodb://ray650128:Zx650128!@ray650128.com:27017")
|
||||
private val client = KMongo.createClient("mongodb://ray650128:Zx650128!@192.168.50.128:27017")
|
||||
private val database = client.getDatabase("pc_re_dive_clan_battle")
|
||||
private val recordCollection = database.getCollection<MemberRecord>()
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.litote.kmongo.*
|
||||
import org.litote.kmongo.id.toId
|
||||
|
||||
object MemberService {
|
||||
private val client = KMongo.createClient("mongodb://ray650128:Zx650128!@ray650128.com:27017")
|
||||
private val client = KMongo.createClient("mongodb://ray650128:Zx650128!@192.168.50.128:27017")
|
||||
private val database = client.getDatabase("pc_re_dive_clan_battle")
|
||||
private val memberCollection = database.getCollection<Member>()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user