Skip to content
Open
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
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Build stage
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src

COPY SupportBoi.csproj .
COPY lib/ lib/
RUN dotnet restore -r linux-x64

COPY . .
RUN dotnet publish -c Release -r linux-x64 --self-contained -o /app --no-restore

# Runtime image
FROM mcr.microsoft.com/dotnet/runtime-deps:9.0
WORKDIR /app

COPY --from=build /app .

ENTRYPOINT ["./supportboi"]
30 changes: 30 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
services:
supportboi:
image: supportboi:latest
restart: unless-stopped
volumes:
- ./config.yml:/app/config.yml:ro
- ./transcripts:/app/transcripts
- ./logs:/app/log
depends_on:
supportboi-db:
condition: service_healthy

supportboi-db:
image: mariadb:11
restart: unless-stopped
environment:
MARIADB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:?required}
MARIADB_DATABASE: supportboi
MARIADB_USER: supportboi
MARIADB_PASSWORD: ${DB_PASSWORD:?required}
volumes:
- db_data:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 5

volumes:
db_data:
55 changes: 55 additions & 0 deletions docs/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,61 @@

</details>

> [!WARNING]
> Only advanced users beyond this point.

<details>
<summary><b>Docker</b></summary>
<br/>

Until Karl uploads an official container image you need to build the container yourself.

**0.** In the main directory you can build the container image with

Check notice on line 187 in docs/Installation.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/Installation.md#L187

Expected: 0 or 2; Actual: 1

```bash
sudo docker build -t supportboi:latest .
```

**1.** Create a compose file

You can use compose.yaml in the main repo as a reference.

**2.** Set up the config.yml file

```bash
curl -so config.yml https://raw.githubusercontent.com/KarlOfDuty/SupportBoi/refs/heads/main/default_config.yml
```

Open the bot config using your preferred text editor and set it up to your liking. It contains instructions for all options

If you are defining the bot and database in the same file you can set the database address to the database container name.

```yaml
database:
# Address and port of the mysql server.
address: "supportboi-db"
port: 3306
```

Set the log file and transcript dir to bind mounts so you can reach them on the host system.

```yaml
transcript-dir: "/app/transcripts"
log-file: "/app/log/supportboi.log"
```

**3.** Run the compose file

If you are using the example compose.yaml you need to source the database passwords that will be used to create the database!

Start the bot and database:

```
sudo docker compose up -d
```

</details>

# Database Setup
This guide assumes a MySQL/MariaDB installation, but it will be the same with other compatible database servers.

Expand Down