Skip to content

Commit

Permalink
feat: Docker のサポート (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
m1sk9 authored Aug 27, 2023
1 parent 7e455fb commit 84ebfc1
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
```

0 comments on commit 84ebfc1

Please sign in to comment.