-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
63 lines (46 loc) · 2.03 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# ------------------------------------------------------------------------------
# App Base Stage
# ------------------------------------------------------------------------------
FROM debian:bookworm AS app-base
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
libfreetype6 \
libfontconfig1 \
libxcursor1 \
xauth \
xorg \
xvfb \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# ------------------------------------------------------------------------------
# Linkerd Utils Stage
# mostly useful for cron jobs, where we need to signal shutdown
# ------------------------------------------------------------------------------
FROM docker.io/curlimages/curl:latest as linkerd
ARG LINKERD_AWAIT_VERSION=v0.2.7
RUN curl -sSLo /tmp/linkerd-await https://github.com/linkerd/linkerd-await/releases/download/release%2F${LINKERD_AWAIT_VERSION}/linkerd-await-${LINKERD_AWAIT_VERSION}-amd64 && \
chmod 755 /tmp/linkerd-await
# ------------------------------------------------------------------------------
# Cargo Build Stage
# ------------------------------------------------------------------------------
FROM rust:latest AS cargo-build
RUN apt-get update && apt-get install -y \
ca-certificates \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/text-to-cad-discord-bot
RUN rustup component add rustfmt
COPY . .
ARG BUILD_MODE=debug
# Run cargo build, with --release if BUILD_MODE is set to release
RUN if [ "$BUILD_MODE" = "release" ] ; then cargo build --all --release ; else cargo build --all ; fi
# ------------------------------------------------------------------------------
# Final Stage
# ------------------------------------------------------------------------------
FROM app-base
ARG BUILD_MODE=debug
COPY --from=linkerd /tmp/linkerd-await /usr/bin/linkerd-await
COPY --from=cargo-build /usr/src/text-to-cad-discord-bot/target/${BUILD_MODE}/text-to-cad-discord-bot /usr/bin/text-to-cad-discord-bot
CMD ["text-to-cad-discord-bot", "--json", "server"]