-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdev.Dockerfile
More file actions
39 lines (28 loc) · 975 Bytes
/
dev.Dockerfile
File metadata and controls
39 lines (28 loc) · 975 Bytes
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
FROM rust:latest AS chef
# Install cargo-chef for dependency caching
RUN cargo install cargo-chef cargo-watch
WORKDIR /app
FROM chef AS planner
# Copy source to create recipe
COPY cryptify/Cargo.toml .
COPY cryptify/Cargo.lock .
COPY cryptify/src ./src
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
ENV ROCKET_PROFILE=debug
# Install system dependencies
RUN apt-get update \
&& apt-get --no-install-recommends install -y libssl-dev pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Build dependencies using recipe (this layer gets cached!)
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --recipe-path recipe.json
# Copy lockfile and manifest
COPY cryptify/Cargo.toml .
COPY cryptify/Cargo.lock .
# Create data directory
RUN mkdir -p /tmp/data
# The actual source will be mounted as a volume
EXPOSE 8000
# Use cargo-watch to rebuild only app code when source changes
CMD ["cargo", "watch", "--poll", "-x", "run"]