forked from calfonso/rusternetes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (40 loc) · 1.46 KB
/
Copy pathDockerfile
File metadata and controls
54 lines (40 loc) · 1.46 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
# Multi-stage build for Rusternetes components
# This Dockerfile can build any component by specifying --build-arg COMPONENT=<name>
FROM rust:latest AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
protobuf-compiler \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy workspace manifest
COPY Cargo.toml Cargo.lock* ./
# Vendored path dependency used by crates/storage.
COPY rhino ./rhino
# Copy all crate manifests + source in one shot. No per-crate manifest
# pre-copy here: there is no intermediate `cargo build` before the source
# copy below, so a layered manifest cache buys nothing. (The cache-layered
# two-pass build lives in services.Dockerfile / all-in-one.Dockerfile, whose
# per-crate enumeration blocks must stay in sync with the workspace members.)
COPY crates ./crates
# Build for release
RUN cargo build --release
# Runtime stage
FROM debian:sid-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# This will be populated by the specific component Dockerfile
ARG COMPONENT
ENV COMPONENT=${COMPONENT}
# Copy the binary from builder
COPY --from=builder /app/target/release/${COMPONENT} /app/${COMPONENT}
# Expose default ports (these vary by component)
# API Server: 6443
# Others use etcd communication
# Run the component
ENTRYPOINT ["/bin/sh", "-c", "/app/${COMPONENT}"]