Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfbacon committed Oct 19, 2024
2 parents 68428f5 + 6be5470 commit d3d0195
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
# ============ Build Stage ============
FROM rust:1.74-bookworm as build

FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
WORKDIR /typst-bot

FROM chef AS planner

# Compilation requires only the source code.
COPY Cargo.toml Cargo.lock ./
COPY crates crates
RUN cargo chef prepare --recipe-path recipe.json

RUN cargo build --release --all --config git-fetch-with-cli=true
FROM chef AS builder

COPY --from=planner /typst-bot/recipe.json recipe.json
# Caching layer
RUN cargo chef cook --release --workspace --recipe-path recipe.json
# Compilation requires only the source code.
COPY Cargo.toml Cargo.lock ./
COPY crates crates
RUN cargo build --release --workspace --config git-fetch-with-cli=true

# ============ Run Stage ============
FROM debian:bookworm-slim as run
Expand All @@ -26,11 +35,12 @@ RUN mkdir -p /bot/sqlite /bot/cache && \
touch /bot/sqlite/db.sqlite

# The only files we need from the build stage in order to run the bot are the two executables.
COPY --from=build \
COPY --from=builder \
/typst-bot/target/release/worker \
/typst-bot/target/release/typst-bot \
./

# Fonts are copied from the host at the very end so that the fonts can get updated without
# invalidating any previously cached image layers.
COPY fonts fonts

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ and start the container with `docker compose up -d`.

Here is a link you can use to invite a public instance run by [@frozolotl](https://github.com/frozolotl): https://discord.com/oauth2/authorize?client_id=1183804211264225301&permissions=3072&scope=bot

Note: the bot may be limited from joining more servers because we require the message content (since slash commands don't support code blocks) and Discord denied verification, so we are limited to 100 servers. Accordingly, we request that you remove the bot from your servers if you are not using it anymore.

## License

AGPL. Use `?source` to get a link to the source from deployments of the bot.

0 comments on commit d3d0195

Please sign in to comment.