forked from madara-alliance/madara
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (29 loc) · 907 Bytes
/
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
# Stage 1: Build the application
FROM rust:1.78 as builder
# Install build dependencies
RUN apt-get -y update && \
apt-get install -y clang && \
apt-get autoremove -y; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /usr/src/madara/
# Copy the source code into the container
COPY Cargo.toml Cargo.lock ./
COPY crates crates
# Build the application in release mode
RUN cargo build --release
# Stage 2: Create the final runtime image
FROM debian:bookworm
# Install runtime dependencies
RUN apt-get -y update && \
apt-get install -y openssl ca-certificates tini &&\
apt-get autoremove -y; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /usr/local/bin
# Copy the compiled binary from the builder stage
COPY --from=builder /usr/src/madara/target/release/madara .
# Set the entrypoint
CMD ["./madara"]