Dockerfile

 1# syntax = docker/dockerfile:1.2
 2
 3FROM rust:1.65-bullseye as builder
 4WORKDIR app
 5COPY . .
 6
 7# Compile collab server
 8RUN --mount=type=cache,target=./script/node_modules \
 9    --mount=type=cache,target=/usr/local/cargo/registry \
10    --mount=type=cache,target=./target \
11    cargo build --release --package collab --bin collab
12
13# Copy collab server binary out of cached directory
14RUN --mount=type=cache,target=./target \
15    cp /app/target/release/collab /app/collab
16
17# Copy collab server binary to the runtime image
18FROM debian:bullseye-slim as runtime
19RUN apt-get update; \
20    apt-get install -y --no-install-recommends libcurl4-openssl-dev ca-certificates
21WORKDIR app
22COPY --from=builder /app/collab /app/collab
23COPY --from=builder /app/crates/collab/migrations /app/migrations
24ENV MIGRATIONS_PATH=/app/migrations
25ENTRYPOINT ["/app/collab"]