mirror of
https://github.com/Eyre-S/Coeur-Morny-Cono.git
synced 2024-11-23 11:37:38 +08:00
add docker, update gradle wrapper
- added Dockerfile and simple example docker-compose.yml - upgrade gradle wrapper: 7.5.1 -> 8.2.1 - tiny code refactor
This commit is contained in:
parent
518bde9404
commit
69a33933f5
17
.dockerignore
Normal file
17
.dockerignore
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
.vscode/
|
||||
.gradle/
|
||||
.settings/
|
||||
/src/test/java/test/*
|
||||
/src/test/resources/test/*
|
||||
|
||||
#build
|
||||
/build/
|
||||
/bin/
|
||||
.project
|
||||
lcoal.properties
|
||||
|
||||
# debug dir
|
||||
/run/
|
21
Dockerfile
Normal file
21
Dockerfile
Normal file
@ -0,0 +1,21 @@
|
||||
FROM eclipse-temurin:20-jdk as build
|
||||
LABEL authors="A.C.Sukazyo Eyre"
|
||||
|
||||
COPY . /app/source/
|
||||
WORKDIR /app
|
||||
|
||||
RUN cd ./source \
|
||||
&& ./gradlew shadowJar -PdockerBuild \
|
||||
&& cd .. \
|
||||
&& cp ./source/build/libs/morny-coeur-docker-build.jar ./morny-coeur.jar
|
||||
#&& rm -r ./source \
|
||||
#&& rm -r /root/.gradle \
|
||||
|
||||
|
||||
FROM eclipse-temurin:20-jre
|
||||
|
||||
COPY --from=build /app/morny-coeur.jar /app/morny-coeur.jar
|
||||
WORKDIR /app
|
||||
|
||||
ENTRYPOINT ["java", "-jar", "morny-coeur.jar"]
|
||||
CMD ["-q", "-v"]
|
38
build.gradle
38
build.gradle
@ -1,36 +1,36 @@
|
||||
import org.ajoberstar.grgit.Status
|
||||
|
||||
import java.nio.charset.Charset
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'java-library'
|
||||
id 'application'
|
||||
id 'maven-publish'
|
||||
id 'com.github.johnrengelman.shadow' version '7.1.2'
|
||||
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
||||
id 'com.github.gmazzo.buildconfig' version '3.1.0'
|
||||
id 'org.ajoberstar.grgit' version '5.0.0'
|
||||
id 'org.ajoberstar.grgit' version '5.2.0'
|
||||
}
|
||||
|
||||
import org.ajoberstar.grgit.Status
|
||||
|
||||
import java.nio.charset.Charset
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
final boolean proj_git = grgit!=null
|
||||
final String proj_store = MORNY_CODE_STORE
|
||||
final String proj_commit = proj_git ? grgit.head().id : null
|
||||
final String proj_commit_path = MORNY_COMMIT_PATH
|
||||
final boolean proj_clean = isCleanBuild()
|
||||
if (!proj_git)
|
||||
print "[MornyBuild] git repository not available for current working space! git version tag will be disabled."
|
||||
println "[MornyBuild] git repository not available for current working space! git version tag will be disabled."
|
||||
else if (isCleanBuild()) {
|
||||
print "git: clean build at ${grgit.head().id}"
|
||||
println "git: clean build at ${grgit.head().id}"
|
||||
} else {
|
||||
final Status status = grgit.status()
|
||||
print "git: non-clean-build"
|
||||
println "git: non-clean-build"
|
||||
if (!status.unstaged.allChanges.empty) {
|
||||
print "\ngit: unstaged changes"
|
||||
println "git: unstaged changes"
|
||||
listChanges(status.unstaged)
|
||||
}
|
||||
if (!status.staged.allChanges.empty) {
|
||||
print "\ngit: staged changes"
|
||||
println "git: staged changes"
|
||||
listChanges(status.staged)
|
||||
}
|
||||
}
|
||||
@ -134,7 +134,15 @@ buildConfig {
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
|
||||
archiveClassifier.set "fat"
|
||||
|
||||
if (project.hasProperty("dockerBuild")) {
|
||||
println "shadow-jar: using docker build name"
|
||||
archiveVersion.set ""
|
||||
archiveClassifier.set "docker-build"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
@ -151,11 +159,11 @@ boolean isCleanBuild () {
|
||||
|
||||
void listChanges (Status.Changes listing) {
|
||||
for (String file in listing.added)
|
||||
print "\n add: ${file}"
|
||||
println " add: ${file}"
|
||||
for (String file in listing.modified)
|
||||
print "\n mod: ${file}"
|
||||
println " mod: ${file}"
|
||||
for (String file in listing.removed)
|
||||
print "\n del: ${file}"
|
||||
println " del: ${file}"
|
||||
}
|
||||
|
||||
publishing {
|
||||
|
4
docker-compose.yml
Normal file
4
docker-compose.yml
Normal file
@ -0,0 +1,4 @@
|
||||
services:
|
||||
coeur-app:
|
||||
build: .
|
||||
command: -v
|
@ -5,7 +5,7 @@ MORNY_ARCHIVE_NAME = morny-coeur
|
||||
MORNY_CODE_STORE = https://github.com/Eyre-S/Coeur-Morny-Cono
|
||||
MORNY_COMMIT_PATH = https://github.com/Eyre-S/Coeur-Morny-Cono/commit/%s
|
||||
|
||||
VERSION = 1.0.0-RC3.7
|
||||
VERSION = 1.0.0-RC3.8
|
||||
|
||||
USE_DELTA = false
|
||||
VERSION_DELTA =
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -97,6 +97,7 @@ public class ServerMain {
|
||||
|
||||
List<String> unknownArgs = new ArrayList<>();
|
||||
|
||||
//# 从命令行参数设置启动参数
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
|
||||
if (args[i].startsWith("-")) {
|
||||
@ -200,6 +201,17 @@ public class ServerMain {
|
||||
|
||||
}
|
||||
|
||||
//# 从环境变量设置启动参数
|
||||
String propToken = null;
|
||||
String propTokenKey = null;
|
||||
for (String iKey : MornyConfig.PROP_TOKEN_KEY) {
|
||||
if (System.getenv(iKey) != null) {
|
||||
propToken = System.getenv(iKey);
|
||||
propTokenKey = iKey;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//#
|
||||
//# 启动信息输出
|
||||
//# 启动相关参数的检查和处理
|
||||
@ -215,15 +227,6 @@ public class ServerMain {
|
||||
|
||||
logger.debug("Debug log output enabled.");
|
||||
|
||||
String propToken = null;
|
||||
String propTokenKey = null;
|
||||
for (String iKey : MornyConfig.PROP_TOKEN_KEY) {
|
||||
if (System.getenv(iKey) != null) {
|
||||
propToken = System.getenv(iKey);
|
||||
propTokenKey = iKey;
|
||||
}
|
||||
}
|
||||
|
||||
if (versionEchoMode) {
|
||||
|
||||
logger.info(String.format("""
|
||||
|
Loading…
Reference in New Issue
Block a user