-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
41 lines (30 loc) · 1.02 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
ARG PACKAGE="glowrs-server"
ARG FEATURES=""
# Build container
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
WORKDIR /build
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /build/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --recipe-path recipe.json
# Build application
ARG PACKAGE
COPY . .
RUN cargo build --release --bin $PACKAGE --features "$FEATURES"
# Final image
FROM debian:stable-slim
# Installing nativetls dependencies
RUN apt-get update && \
apt-get install -y openssl libssl-dev ca-certificates && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
ARG PACKAGE
COPY --from=builder /build/target/release/$PACKAGE /app/$PACKAGE
HEALTHCHECK --interval=30s --start-period=10s --retries=3 CMD bash -c ':> /dev/tcp/0.0.0.0/3000' || exit 1
ENV RUST_LOG="glowrs=debug,server=debug,tower_http=debug,axum::rejection=trace"
# Running
EXPOSE 3000
ENTRYPOINT ["./glowrs-server", "--host", "0.0.0.0"]