diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7bf9295 --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..f7e5a6e --- /dev/null +++ b/compose.yaml @@ -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: diff --git a/docs/Installation.md b/docs/Installation.md index 966d1e1..1dceb38 100644 --- a/docs/Installation.md +++ b/docs/Installation.md @@ -175,6 +175,61 @@ While the Windows versions are fully supported they are not as well tested as th +> [!WARNING] +> Only advanced users beyond this point. + +
+Docker +
+ +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 + +```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 +``` + +
+ # Database Setup This guide assumes a MySQL/MariaDB installation, but it will be the same with other compatible database servers.