diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..cbd56e5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,15 @@ +### Rust template +# Generated by Cargo +# will have compiled files and executables +debug/ +target/ + +# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries +# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html +Cargo.lock + +# These are backup files generated by rustfmt +**/*.rs.bk + +# MSVC Windows builds of rustc generate these, which store debugging information +*.pdb diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8d2fa4c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM rust:1.72.0-bullseye as Builder + +WORKDIR /root/app +COPY --chown=root:root . . + +RUN cargo build --release --bin babyrite --features enable_sentry + +FROM debian:bullseye-slim as Runner + +COPY --from=Builder --chown=root:root /root/app/target/release/babyrite /usr/local/bin/babyrite + +RUN apt-get update && apt-get install -y libssl-dev ca-certificates + +RUN useradd --create-home --user-group babyrite +USER babyrite +WORKDIR /home/babyrite + +LABEL org.opencontainers.image.source=https://github.com/m1sk9/babyrite +ENTRYPOINT [ "babyrite" ] diff --git a/README.md b/README.md index e653e3a..f56353b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,62 @@ # babyrite +[![Release babyrite](https://github.com/m1sk9/babyrite/actions/workflows/release.yaml/badge.svg)](https://github.com/m1sk9/babyrite/actions/workflows/release.yaml) +[![Build babyrite](https://github.com/m1sk9/babyrite/actions/workflows/build.yaml/badge.svg)](https://github.com/m1sk9/babyrite/actions/workflows/build.yaml) +[![clippy](https://github.com/m1sk9/babyrite/actions/workflows/clippy.yaml/badge.svg)](https://github.com/m1sk9/babyrite/actions/workflows/clippy.yaml) +[![rustfmt](https://github.com/m1sk9/babyrite/actions/workflows/fmt.yaml/badge.svg)](https://github.com/m1sk9/babyrite/actions/workflows/fmt.yaml) + A citation message Discord bot + +## Features + +- メッセージリンクのメッセージ内容を展開する + +### Todo + +- [ ] 添付ファイルのサポート + +## Installation + +babyrite の Docker Image は ghcr.io から取得することができます. + +```shell +# 最新版 +docker pull ghcr.io/m1sk9/babyrite:latest + +# マイナーバージョン (v0.x) +## 破壊的変更がない限りは互換性があります. こちらから取得することをおすすめします. +docker pull ghcr.io/m1sk9/babyrite:v0 + +# バージョン指定 +docker pull ghcr.io/m1sk9/babyrite:vX.Y.Z +``` + +取得した Docker Image に対して環境変数を与えると babyrite を起動できます. + +## Features Flag + +babyrite の各オプション機能は Features Flag で有効化が可能です. + +> **Note** +> +> Docker Image で起動する際は一部の Features Flag のみが利用できます. 自由に設定するには自分でビルドする必要があります. + +| Flag | Description | Default (Docker Image) | +| ---- | ----------- | ------- | +| `enable_sentry` | Sentry によるエラー報告を有効化します. | `true` | + +## Environment Variables + +以下は babyrite が利用する環境変数です. + +`Required` カラムが `Yes` の Key は指定必須です. 指定しない場合は正しく起動しません. + +| Key | Description | Required | Default | +| --- | ----------- | -------- | ------- | +| `DISCORD_API_TOKEN` | Discord API トークン | Yes | --- | + +環境変数の設定例は [`.env.example`](.env.example) を参照してください. + +```shell +cp .env.example .env +```