-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
155 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Lagrange.OneBot Docker Push | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
branches: | ||
- 'master' | ||
paths: | ||
- "**.cs" | ||
- "Dockerfile" | ||
- "**.csproj" | ||
- "appsettings.onebot.json" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
docker.io/${{ secrets.DOCKER_USERNAME }}/lagrange.onebot | ||
tags: | | ||
type=edge | ||
type=sha,event=branch | ||
type=ref,event=tag | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/arm64/v8, linux/amd64 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Lagrange.Core | ||
|
||
[![Core](https://img.shields.io/badge/Lagrange-Core-blue)](#) | ||
[![OneBot](https://img.shields.io/badge/Lagrange-OneBot-blue)](#) | ||
[![C#](https://img.shields.io/badge/Core-%20.NET_6-blue)](#) | ||
[![C#](https://img.shields.io/badge/OneBot-%20.NET_7-blue)](#) | ||
|
||
[![License](https://img.shields.io/static/v1?label=LICENSE&message=GPL-3.0&color=lightrey)](#) | ||
[![Telegram](https://img.shields.io/endpoint?url=https%3A%2F%2Ftelegram-badge-4mbpu8e0fit4.runkit.sh%2F%3Furl%3Dhttps%3A%2F%2Ft.me%2F%2B6HNTeJO0JqtlNmRl)](https://t.me/+6HNTeJO0JqtlNmRl) | ||
|
||
An Implementation of NTQQ Protocol, with Pure C#, Derived from Konata.Core | ||
|
||
|
||
# Using with Docker | ||
|
||
```bash | ||
# 8081 port for ForwardWebSocket | ||
docker run -d -p 8081:8081 eric1008818/lagrange.onebot:edge | ||
``` | ||
|
||
## Persistence Storage | ||
|
||
```bash | ||
docker volume create lagrange_data | ||
docker run -d -v lagrange_data:/app/data eric1008818/lagrange.onebot:edge | ||
``` | ||
|
||
## Configure appsettings.json in Docker | ||
|
||
### Using Mount | ||
|
||
use bind mount to mount your `appsettings.json` to `/App/appsettings.json` | ||
```bash | ||
docker run -d -v /etc/appsettings.json:/appsettings.json eric1008818/lagrange.onebot:edge | ||
``` | ||
|
||
### Using Environment Variables | ||
|
||
use [Enviroment Variables](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-7.0#naming-of-environment-variables) to set your appsettings.json | ||
```bash | ||
# disable reverse websocket | ||
docker run -d -e Implementations__1__Enable=false eric1008818/lagrange.onebot:edge | ||
``` | ||
|
||
```bash | ||
# input username and password | ||
docker run -d -e Account__Uin=123456 -e Account__Password=1234 eric1008818/lagrange.onebot:edge | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine3.18 AS build-env | ||
WORKDIR /App | ||
|
||
COPY . ./ | ||
RUN dotnet publish Lagrange.OneBot/Lagrange.OneBot.csproj \ | ||
-c Release \ | ||
-o out \ | ||
--no-self-contained \ | ||
-p:PublishSingleFile=true \ | ||
-p:IncludeContentInSingleFile=true | ||
|
||
FROM mcr.microsoft.com/dotnet/runtime:7.0-alpine3.18 | ||
WORKDIR /app | ||
COPY --from=build-env /App/out . | ||
COPY appsettings.onebot.json ./appsettings.json | ||
ENTRYPOINT ["./Lagrange.OneBot"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft": "Warning", | ||
"Microsoft.Hosting.Lifetime": "Information" | ||
} | ||
}, | ||
"ConfigPath": { | ||
"Keystore": "./data/keystore.json", | ||
"DeviceInfo": "./data/device.json", | ||
"Database": "./data/Lagrange.db" | ||
}, | ||
"SignServerUrl": "", | ||
"Account": { | ||
"Uin": 0, | ||
"Password": "", | ||
"Protocol": "Linux", | ||
"AutoReconnect": true, | ||
"GetOptimumServer": true | ||
}, | ||
"Implementations": [ | ||
{ | ||
"Type": "ForwardWebSocket", | ||
"Host": "0.0.0.0", | ||
"Port": 8081, | ||
"HeartBeatInterval": 5000, | ||
"AccessToken": "" | ||
}, | ||
{ | ||
"Type": "ReverseWebSocket", | ||
"Host": "127.0.0.1", | ||
"Port": 8080, | ||
"Suffix": "/onebot/v11/ws", | ||
"ReconnectInterval": 5000, | ||
"HeartBeatInterval": 5000, | ||
"AccessToken": "" | ||
} | ||
] | ||
} |