forked from mattfbacon/typst-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
34 lines (25 loc) · 1.01 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# ============ Build Stage ============
FROM rust:1.74-bookworm as build
WORKDIR /typst-bot
# Compilation requires only the source code.
COPY Cargo.toml Cargo.lock ./
COPY protocol protocol
COPY worker worker
COPY bot bot
RUN cargo build --release --all --config git-fetch-with-cli=true
# ============ Run Stage ============
FROM debian:bookworm-slim as run
WORKDIR /bot
CMD [ "/bot/typst-bot" ]
# These variables can get burned into the image without issue. We don't want `DISCORD_TOKEN` saved
# in the image, though; it needs to come from the user (or from Compose) when the container is run.
ENV DB_PATH=/bot/sqlite/db.sqlite \
CACHE_DIRECTORY=/bot/cache
# The only files we need from the build stage in order to run the bot are the two executables.
COPY --from=build \
/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