更新环境变量

This commit is contained in:
2026-01-21 10:40:34 +08:00
parent c54f76cd0c
commit bd0bc02f0d
7 changed files with 63 additions and 13 deletions

9
.dockerignore Normal file
View File

@@ -0,0 +1,9 @@
.dockerignore
Dockerfile
build/
.dart_tool/
.git/
.github/
.gitignore
.idea/
.packages

17
Dockerfile Normal file
View File

@@ -0,0 +1,17 @@
# Use latest stable channel SDK.
FROM dart:3.5.4 AS build
LABEL qmqz=admin@ipayl.com
# Resolve app dependencies.
WORKDIR /app
COPY pubspec.* ./
RUN export PUB_HOSTED_URL=https://pub.flutter-io.cn && dart pub get
ADD bin /app/bin
RUN dart compile exe bin/main.dart -o bin/server
FROM scratch
COPY --from=build /runtime/ /
COPY --from=build /app/bin/server /app/bin/
CMD ["/app/bin/server"]

View File

@@ -10,7 +10,6 @@ import './controller/AreaController.dart';
import 'const/ServiceConstant.dart'; import 'const/ServiceConstant.dart';
import './const/CommonVariables.dart'; import './const/CommonVariables.dart';
void main(List<String> args) async { void main(List<String> args) async {
@@ -21,14 +20,34 @@ Future<void> initEasyDartModule() async {
try { try {
String? web = Platform.environment["web_port"] ?? "9200"; String? web = Platform.environment["web_port"] ?? "9200";
List<String> redis = List<String> redis =
(Platform.environment["redis"] ?? "127.0.0.1:6379").split(":"); (Platform.environment["redis"] ?? "default@localhost:6379/0")
if (redis.length == 1) { .split(":");
redis.add("6379"); String host;
int port = 6379;
String? password;
int db = 0;
var hs = redis[0].split("@");
if (hs.length == 2) {
host = hs[1];
if (hs[0] != "default") {
password = hs[0];
} }
} else {
host = hs[0];
}
var pd = redis[1].split("/");
if (pd.length == 2) {
db = int.parse(pd[1]);
port = int.parse(pd[0]);
} else {
port = int.parse(pd[0]);
}
EasyDartModule.init( EasyDartModule.init(
loggerConfig: LoggerConfig( loggerConfig: LoggerConfig(
host: ServiceConstant.logService, serviceName: "快检报告服务"), host: ServiceConstant.logService, serviceName: "快检报告服务"),
redisConfig: RedisConfig(host: redis[0], port: int.parse(redis[1])), redisConfig: RedisConfig(
host: host, port: port, database: db, password: password),
webSocketConfig: webSocketConfig:
WebSocketConfig(ServiceConstant.webSocketService, (data) { WebSocketConfig(ServiceConstant.webSocketService, (data) {
// 接收到服务消息 // 接收到服务消息

2
build.bat Normal file
View File

@@ -0,0 +1,2 @@
@echo off
docker build -t 10.20.2.5:5000/kuaijian .

View File

@@ -6,7 +6,7 @@ packages:
description: description:
path: "." path: "."
ref: master ref: master
resolved-ref: a34d58f93eb692c976d1be165920a03a54dea027 resolved-ref: e21033bc10973d40ff9cd4369a1efb9f7c30b0bb
url: "https://git.he-info.cn/qmqz/easy_dart_module.git" url: "https://git.he-info.cn/qmqz/easy_dart_module.git"
source: git source: git
version: "1.0.0" version: "1.0.0"
@@ -14,15 +14,15 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: _fe_analyzer_shared name: _fe_analyzer_shared
sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab" sha256: "45cfa8471b89fb6643fe9bf51bd7931a76b8f5ec2d65de4fb176dba8d4f22c77"
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "76.0.0" version: "73.0.0"
_macros: _macros:
dependency: transitive dependency: transitive
description: dart description: dart
source: sdk source: sdk
version: "0.3.3" version: "0.3.2"
adaptive_number: adaptive_number:
dependency: transitive dependency: transitive
description: description:
@@ -35,10 +35,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: analyzer name: analyzer
sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e" sha256: "4959fec185fe70cce007c57e9ab6983101dbe593d2bf8bbfb4453aaec0cf470a"
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "6.11.0" version: "6.8.0"
args: args:
dependency: transitive dependency: transitive
description: description:
@@ -371,10 +371,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: macros name: macros
sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656" sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536"
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.1.3-main.0" version: "0.1.2-main.4"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:

View File

@@ -1,6 +1,7 @@
name: report_data_service name: report_data_service
description: A sample command-line application. description: A sample command-line application.
version: 1.0.0 version: 1.0.0
publish_to: none
# repository: https://github.com/my_org/my_repo # repository: https://github.com/my_org/my_repo
environment: environment:

2
push.bat Normal file
View File

@@ -0,0 +1,2 @@
@echo off
docker push 10.20.2.5:5000/kuaijian