-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
42 lines (30 loc) · 1.14 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
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
WORKDIR /app
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
RUN rustc --version; cargo --version; rustup --version
RUN apt-get update && apt-get install -y \
protobuf-compiler libasound2-dev clang cmake \
&& rm -rf /var/lib/apt/lists/*
RUN curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 && \
chmod +x tailwindcss-linux-x64 && \
mv tailwindcss-linux-x64 tailwindcss
COPY --from=planner /app/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --bin server --recipe-path recipe.json
COPY . .
COPY tailwind.config.js .
RUN ./tailwindcss -i server/src/styles/tailwind.css -o target/tailwind.css
RUN cargo build --release --locked --bin server
# Start building the final image
FROM debian:stable-slim as final
WORKDIR /app
RUN apt-get update && apt-get install -y \
ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& update-ca-certificates
COPY --from=builder /app/target/release/server .
EXPOSE 3000
ENTRYPOINT ["./server"]