-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (37 loc) · 1.17 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
# Get started with a build env with Rust nightly
FROM rustlang/rust:nightly-bullseye AS builder
# Install essential dev packages
RUN apt-get update && \
apt-get install -y \
build-essential \
cmake \
libclang-dev \
libssl-dev \
pkg-config \
libpq-dev \
&& apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Set the LIBCLANG_PATH environment variable
ENV LIBCLANG_PATH=/usr/lib/llvm-11/lib
# Set the working directory
WORKDIR /app
# Copy the entire workspace
COPY . .
# Build the app
RUN cargo build --release -p leaky-server -vv
FROM debian:bullseye-slim AS runtime
WORKDIR /app
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends openssl ca-certificates \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
# Copy the server binary to the /app directory
COPY --from=builder /app/target/release/leaky-server /app/
# Copy Cargo.toml files if they're needed at runtime
COPY --from=builder /app/Cargo.toml /app/
COPY --from=builder /app/crates/leaky-server/Cargo.toml /app/crates/leaky-server/
# Set any required env variables and expose the port
EXPOSE 3000
# Run the server
CMD ["/app/leaky-server"]