-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
25 lines (24 loc) · 966 Bytes
/
Copy pathDockerfile
File metadata and controls
25 lines (24 loc) · 966 Bytes
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
FROM rust:1-bookworm AS builder
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends pkg-config \
&& rm -rf /var/lib/apt/lists/*
COPY Cargo.toml Cargo.lock ./
COPY migrations ./migrations
COPY src ./src
RUN cargo build --release --locked
FROM debian:bookworm-slim AS runtime
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl tini \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --uid 10001 --create-home --home-dir /app --shell /bin/bash discordbot
WORKDIR /app
COPY --from=builder /app/target/release/discordbot /usr/local/bin/discordbot
COPY --from=builder /app/migrations ./migrations
RUN mkdir -p /app/.runtime /app/data && chown -R discordbot:discordbot /app
USER discordbot
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD curl --fail --silent --max-time 4 http://localhost:3000/health || exit 1
ENTRYPOINT ["/usr/bin/tini","--"]
CMD ["discordbot"]