-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.data
More file actions
47 lines (33 loc) · 1.08 KB
/
Dockerfile.data
File metadata and controls
47 lines (33 loc) · 1.08 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
FROM rust:1.83-alpine AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache \
musl-dev \
protobuf \
protobuf-dev \
ca-certificates
# Copy cargo files first for caching
COPY data-plane/Cargo.toml ./
COPY data-plane/build.rs ./
# Copy proto files to expected location
COPY proto/ ../proto/
# Create dummy main.rs to cache dependencies
RUN mkdir src && \
echo "fn main() {}" > src/main.rs && \
cargo build --release && \
rm -rf src
# Copy actual source
COPY data-plane/src ./src
# Build with optimizations
RUN RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --target x86_64-unknown-linux-musl && \
strip target/x86_64-unknown-linux-musl/release/aegis-data
# Final stage
FROM alpine:latest
RUN apk --no-cache add ca-certificates libgcc busybox-extras
WORKDIR /root/
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/aegis-data .
EXPOSE 50051 8080 8081
# Health check via gRPC
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD nc -z localhost 50051 || exit 1
ENTRYPOINT ["./aegis-data"]