-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathDockerfile.standalone
More file actions
61 lines (41 loc) · 1.26 KB
/
Dockerfile.standalone
File metadata and controls
61 lines (41 loc) · 1.26 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Stage 1: Generate dependency recipe
FROM rust:1.87.0 AS planner
WORKDIR /app
RUN cargo install cargo-chef
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
# Stage 2: Build dependencies (cached layer)
FROM rust:1.87.0 AS cacher
WORKDIR /app
# Install system OpenSSL
RUN apt-get update && apt-get install -y \
libssl-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
RUN cargo install cargo-chef
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --features neo4j --recipe-path recipe.json
# Stage 3: Build application
FROM rust:1.87.0 AS builder
WORKDIR /app
# Install system OpenSSL
RUN apt-get update && apt-get install -y \
libssl-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
COPY . .
# Copy cached dependencies
COPY --from=cacher /app/target target
COPY --from=cacher /usr/local/cargo /usr/local/cargo
RUN cargo build --release --bin standalone \
--features neo4j
# Runtime stage
FROM sphinxlightning/stakgraph-lsp:latest
WORKDIR /app
RUN apt-get update && apt-get install -y \
libssl3 \
openssh-client \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/standalone /app/stakgraph
COPY --from=builder /app/standalone/static /app/standalone/static
CMD ["./stakgraph"]