submodule对gitea不管用,所以直接拉了一份拉格兰
This commit is contained in:
26
Lagrange.Core/Lagrange.OneBot/Resources/Dockerfile
Normal file
26
Lagrange.Core/Lagrange.OneBot/Resources/Dockerfile
Normal file
@@ -0,0 +1,26 @@
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build-env
|
||||
|
||||
WORKDIR /root/build
|
||||
ARG TARGETARCH
|
||||
|
||||
COPY . /root/build
|
||||
|
||||
RUN dotnet publish -p:DebugType="none" -a $TARGETARCH -f "net9.0" -o "/root/out" "Lagrange.OneBot"
|
||||
|
||||
# ===
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/runtime:9.0-alpine
|
||||
|
||||
WORKDIR /app/data
|
||||
|
||||
COPY --from=build-env /root/out /app/bin
|
||||
COPY Lagrange.OneBot/Resources/docker-entrypoint.sh /app/bin/docker-entrypoint.sh
|
||||
|
||||
ENV UID=100
|
||||
ENV GID=100
|
||||
|
||||
RUN apk --no-cache add shadow su-exec \
|
||||
&& adduser -D user \
|
||||
&& chmod +x /app/bin/docker-entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/app/bin/docker-entrypoint.sh"]
|
||||
37
Lagrange.Core/Lagrange.OneBot/Resources/appsettings.json
Normal file
37
Lagrange.Core/Lagrange.OneBot/Resources/appsettings.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/LagrangeDev/Lagrange.Core/master/Lagrange.OneBot/Resources/appsettings_schema.json",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"SignServerUrl": "",
|
||||
"SignProxyUrl": "",
|
||||
"MusicSignServerUrl": "",
|
||||
"Account": {
|
||||
"Uin": 0,
|
||||
"Protocol": "Linux",
|
||||
"AutoReconnect": true,
|
||||
"GetOptimumServer": true
|
||||
},
|
||||
"Message": {
|
||||
"IgnoreSelf": true,
|
||||
"StringPost": false
|
||||
},
|
||||
"QrCode": {
|
||||
"ConsoleCompatibilityMode": false
|
||||
},
|
||||
"Implementations": [
|
||||
{
|
||||
"Type": "ReverseWebSocket",
|
||||
"Host": "127.0.0.1",
|
||||
"Port": 8080,
|
||||
"Suffix": "/onebot/v11/ws",
|
||||
"ReconnectInterval": 5000,
|
||||
"HeartBeatInterval": 5000,
|
||||
"AccessToken": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
392
Lagrange.Core/Lagrange.OneBot/Resources/appsettings_schema.json
Normal file
392
Lagrange.Core/Lagrange.OneBot/Resources/appsettings_schema.json
Normal file
@@ -0,0 +1,392 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft-07/hyper-schema#",
|
||||
"allOf": [
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Logging": {
|
||||
"$ref": "#/definitions/logging"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Account": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Uin": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"description": "Uin, Only used to create lagrange-{uin}.db and qr-{uin}.png",
|
||||
"default": 0
|
||||
},
|
||||
"Protocol": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Linux",
|
||||
"Windows",
|
||||
"MacOs"
|
||||
],
|
||||
"description": "Protocol Platform",
|
||||
"default": "Linux"
|
||||
},
|
||||
"AutoReconnect": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to auto reconnect",
|
||||
"default": true
|
||||
},
|
||||
"UseIPv6Network": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to use IPv6, IPv6 implementation has an exception",
|
||||
"default": false
|
||||
},
|
||||
"GetOptimumServer": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to get optimum server",
|
||||
"default": true
|
||||
},
|
||||
"AutoReLogin": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to auto relogin",
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"ConfigPath": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Keystore": {
|
||||
"type": "string",
|
||||
"description": "Keystore file location",
|
||||
"default": "keystore.json"
|
||||
},
|
||||
"DeviceInfo": {
|
||||
"type": "string",
|
||||
"description": "device file location",
|
||||
"default": "device.json"
|
||||
},
|
||||
"Database": {
|
||||
"type": "string",
|
||||
"description": "database file location",
|
||||
"default": "lagrange.db"
|
||||
},
|
||||
"AppInfo": {
|
||||
"type": "string",
|
||||
"description": "appinfo file location",
|
||||
"default": "appinfo.db"
|
||||
}
|
||||
}
|
||||
},
|
||||
"MusicSignServerUrl": {
|
||||
"type": "string",
|
||||
"description": "Music signer url",
|
||||
"default": ""
|
||||
},
|
||||
"SignServerUrl": {
|
||||
"type": "string",
|
||||
"description": "Signer url",
|
||||
"default": ""
|
||||
},
|
||||
"SignProxyUrl": {
|
||||
"type": "string",
|
||||
"description": "Signer proxy url, only support HTTP proxy",
|
||||
"default": ""
|
||||
},
|
||||
"Message": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"IgnoreSelf": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to ignore self",
|
||||
"default": false
|
||||
},
|
||||
"StringPost": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to post by string",
|
||||
"default": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"QrCode": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ConsoleCompatibilityMode": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to show compatibility qrcode",
|
||||
"default": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"Implementations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ReverseWebSocket"
|
||||
],
|
||||
"description": "Implementation type"
|
||||
},
|
||||
"Host": {
|
||||
"type": "string",
|
||||
"description": "WS connect host"
|
||||
},
|
||||
"Port": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 65535
|
||||
},
|
||||
"Suffix": {
|
||||
"type": "string",
|
||||
"description": "WS path"
|
||||
},
|
||||
"ReconnectInterval": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"description": "Reconnect interval"
|
||||
},
|
||||
"HeartBeatInterval": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"description": "Heart beat interval, 0 to disable"
|
||||
},
|
||||
"HeartBeatEnable": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to send heart beat"
|
||||
},
|
||||
"AccessToken": {
|
||||
"type": "string",
|
||||
"description": "Access token"
|
||||
}
|
||||
},
|
||||
"description": "Implementation"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ForwardWebSocket"
|
||||
],
|
||||
"description": "Implementation type"
|
||||
},
|
||||
"Host": {
|
||||
"type": "string",
|
||||
"description": "WS bind host"
|
||||
},
|
||||
"Port": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 65535
|
||||
},
|
||||
"HeartBeatInterval": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"description": "Heart beat interval, 0 to disable"
|
||||
},
|
||||
"HeartBeatEnable": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to send heart beat"
|
||||
},
|
||||
"AccessToken": {
|
||||
"type": "string",
|
||||
"description": "Access token"
|
||||
}
|
||||
},
|
||||
"description": "Implementation"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"HttpPost"
|
||||
],
|
||||
"description": "Implementation type"
|
||||
},
|
||||
"Host": {
|
||||
"type": "string",
|
||||
"description": "Http connect host"
|
||||
},
|
||||
"Port": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 65535
|
||||
},
|
||||
"Suffix": {
|
||||
"type": "string",
|
||||
"description": "Http path"
|
||||
},
|
||||
"HeartBeatInterval": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"description": "Heart beat interval, 0 to disable"
|
||||
},
|
||||
"HeartBeatEnable": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to send heart beat"
|
||||
},
|
||||
"AccessToken": {
|
||||
"type": "string",
|
||||
"description": "Access token"
|
||||
}
|
||||
},
|
||||
"description": "Implementation"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Http"
|
||||
],
|
||||
"description": "Implementation type"
|
||||
},
|
||||
"Host": {
|
||||
"type": "string",
|
||||
"description": "Http bind host"
|
||||
},
|
||||
"Port": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 65535
|
||||
},
|
||||
"AccessToken": {
|
||||
"type": "string",
|
||||
"description": "Access token"
|
||||
}
|
||||
},
|
||||
"description": "Implementation"
|
||||
}
|
||||
]
|
||||
},
|
||||
"description": "Implementation to use"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"definitions": {
|
||||
"logging": {
|
||||
"title": "logging options",
|
||||
"type": "object",
|
||||
"description": "Configuration for Microsoft.Extensions.Logging.",
|
||||
"properties": {
|
||||
"LogLevel": {
|
||||
"$ref": "#/definitions/logLevel"
|
||||
},
|
||||
"Console": {
|
||||
"properties": {
|
||||
"LogLevel": {
|
||||
"$ref": "#/definitions/logLevel"
|
||||
},
|
||||
"FormatterName": {
|
||||
"description": "Name of the log message formatter to use. Defaults to 'simple'.",
|
||||
"type": "string",
|
||||
"default": "simple"
|
||||
},
|
||||
"FormatterOptions": {
|
||||
"title": "formatter options",
|
||||
"description": "Log message formatter options. Additional properties are available on the options depending on the configured formatter. The formatter is specified by FormatterName.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"IncludeScopes": {
|
||||
"description": "Include scopes when true. Defaults to false.",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"TimestampFormat": {
|
||||
"description": "Format string used to format timestamp in logging messages. Defaults to null.",
|
||||
"type": "string"
|
||||
},
|
||||
"UseUtcTimestamp": {
|
||||
"description": "Indication whether or not UTC timezone should be used to for timestamps in logging messages. Defaults to false.",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"LogToStandardErrorThreshold": {
|
||||
"$ref": "#/definitions/logLevelThreshold",
|
||||
"description": "The minimum level of messages are written to Console.Error."
|
||||
}
|
||||
}
|
||||
},
|
||||
"EventSource": {
|
||||
"properties": {
|
||||
"LogLevel": {
|
||||
"$ref": "#/definitions/logLevel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Debug": {
|
||||
"properties": {
|
||||
"LogLevel": {
|
||||
"$ref": "#/definitions/logLevel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"EventLog": {
|
||||
"properties": {
|
||||
"LogLevel": {
|
||||
"$ref": "#/definitions/logLevel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ElmahIo": {
|
||||
"properties": {
|
||||
"LogLevel": {
|
||||
"$ref": "#/definitions/logLevel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ElmahIoBreadcrumbs": {
|
||||
"properties": {
|
||||
"LogLevel": {
|
||||
"$ref": "#/definitions/logLevel"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": {
|
||||
"title": "provider logging settings",
|
||||
"type": "object",
|
||||
"description": "Logging configuration for a provider. The provider name must match the configuration's JSON property property name.",
|
||||
"properties": {
|
||||
"LogLevel": {
|
||||
"$ref": "#/definitions/logLevel"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"logLevel": {
|
||||
"title": "logging level options",
|
||||
"description": "Log level configurations used when creating logs. Only logs that exceeds its matching log level will be enabled. Each log level configuration has a category specified by its JSON property name. For more information about configuring log levels, see https://docs.microsoft.com/aspnet/core/fundamentals/logging/#configure-logging.",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/logLevelThreshold"
|
||||
}
|
||||
},
|
||||
"logLevelThreshold": {
|
||||
"description": "Log level threshold.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Trace",
|
||||
"Debug",
|
||||
"Information",
|
||||
"Warning",
|
||||
"Error",
|
||||
"Critical",
|
||||
"None"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Lagrange.Core/Lagrange.OneBot/Resources/docker-entrypoint.sh
Normal file
11
Lagrange.Core/Lagrange.OneBot/Resources/docker-entrypoint.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
USER=user
|
||||
|
||||
usermod -o -u ${UID} ${USER} > /dev/null
|
||||
groupmod -o -g ${GID} ${USER} > /dev/null
|
||||
usermod -g ${GID} ${USER} > /dev/null
|
||||
|
||||
chown -R ${UID}:${GID} /app > /dev/null
|
||||
|
||||
exec su-exec $USER /app/bin/Lagrange.OneBot "$@"
|
||||
Reference in New Issue
Block a user