Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.git
.github
.env
.env.*
!.env.example
.pixi
.pixi-cache
.vscode
__pycache__
*.pyc
data/state.json
data/providers.json
temp
paper-bridge/.gradle
paper-bridge/.gradle-user-home
paper-bridge/build
17 changes: 17 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ DISCORD_TOKEN=
DISCORD_TEST_GUILD_ID=

AI_PROVIDER_FILE=data/providers.json
PERSONA_FILE=data/personas.json

GRSAI_BASE_URL=https://grsaiapi.com/v1
GRSAI_DRAW_BASE_URL=https://grsaiapi.com/v1
Expand All @@ -21,7 +22,23 @@ CUSTOM_DRAW_API_KEY=
DANBOORU_BASE_URL=https://danbooru.donmai.us
DANBOORU_USERNAME=
DANBOORU_API_KEY=
RULE34_API_BASE_URL=https://api.rule34.xxx
RULE34_POST_BASE_URL=https://rule34.xxx
RULE34_USER_ID=
RULE34_API_KEY=
SAUCENAO_BASE_URL=https://saucenao.com/search.php
SAUCENAO_API_KEY=

STATE_FILE=data/state.json
HOST=127.0.0.1
PORT=8000

MINECRAFT_BRIDGE_ENABLED=false
MINECRAFT_GUILD_ID=
MINECRAFT_SERVER_ID=default
MINECRAFT_SERVER_ADDRESS=127.0.0.1:25565
MINECRAFT_CHANNEL_ID=
MINECRAFT_TOKEN=
MINECRAFT_ALLOW_NO_TOKEN=true
MINECRAFT_ALLOWED_CLIENTS=
MINECRAFT_MAX_MESSAGE_LENGTH=300
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: FastAPI CI

on:
push:
branches:
- main
- dev
pull_request:

jobs:
fastapi:
name: FastAPI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: pip

- name: Install dependencies
run: pip install -r requirements.txt

- name: Import check
run: python -c "import app.main; import app.run; print('app-import-ok')"
38 changes: 38 additions & 0 deletions .github/workflows/paper-bridge-jar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Paper Bridge Jar

on:
workflow_dispatch:
inputs:
version:
description: Jar version, for example 0.1.0
required: true
default: "0.1.0"

jobs:
build:
name: Build Paper Bridge Jar
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build plugin
run: |
chmod +x paper-bridge/gradlew
paper-bridge/gradlew -p paper-bridge -PpluginVersion=${{ inputs.version }} build

- name: Upload jar artifact
uses: actions/upload-artifact@v4
with:
name: dc-bot-paper-bridge-${{ inputs.version }}
path: paper-bridge/build/libs/*.jar
if-no-files-found: error
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
.tmp/
.pixi/
.pixi-cache/
.gradle/
.gradle-user-home/
build/
__pycache__/
*.pyc
data/state.json
data/providers.json
temp/*
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"python-envs.defaultEnvManager": "ms-python.python:system"
"python-envs.defaultEnvManager": "ms-python.python:system",
"liveServer.settings.port": 5665
}
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM python:3.10-slim

ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
HOST=0.0.0.0 \
PORT=8000

WORKDIR /app

RUN addgroup --system app && adduser --system --ingroup app app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY app ./app
COPY data/personas.json ./data/personas.json

RUN mkdir -p /app/data && chown -R app:app /app

USER app

EXPOSE 8000

HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD python -c "import json, urllib.request; json.load(urllib.request.urlopen('http://127.0.0.1:8000/api/health', timeout=3))"

CMD ["python", "-m", "app.run"]
Loading
Loading