add dockerfile

This commit is contained in:
2026-04-29 18:59:46 +09:00
parent f9f009fcd2
commit 960cf95df9
2 changed files with 13 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
FROM rust:1.87-slim AS builder
FROM rust:1.94-bookworm AS builder
WORKDIR /build
@@ -7,12 +7,10 @@ RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/li
# Copy workspace manifests
COPY Cargo.toml Cargo.lock ./
# Copy only the crates needed for klog-backend
COPY crates/ktracing/Cargo.toml crates/ktracing/Cargo.toml
COPY crates/ktracing-subscriber/Cargo.toml crates/ktracing-subscriber/Cargo.toml
COPY klog/backend/Cargo.toml klog/backend/Cargo.toml
COPY klog/klog-cli/Cargo.toml klog/klog-cli/Cargo.toml
COPY klog/types/Cargo.toml klog/types/Cargo.toml
# Copy workspace member manifests
COPY backend/Cargo.toml backend/Cargo.toml
COPY types/Cargo.toml types/Cargo.toml
COPY cli/Cargo.toml cli/Cargo.toml
# Stub out every workspace member so Cargo can resolve the graph without full source
RUN find . -name "Cargo.toml" -not -path "./Cargo.toml" | while read f; do \
@@ -26,14 +24,11 @@ RUN find . -name "Cargo.toml" -not -path "./Cargo.toml" | while read f; do \
RUN cargo build --release -p klog-backend 2>/dev/null || true
# Now copy real source
COPY crates/ktracing/src crates/ktracing/src
COPY crates/ktracing-subscriber/src crates/ktracing-subscriber/src
COPY klog/backend/src klog/backend/src
COPY klog/types/src klog/types/src
COPY backend/src backend/src
COPY types/src types/src
# Touch to invalidate cached stubs
RUN find klog/backend/src klog/types/src crates/ktracing/src crates/ktracing-subscriber/src \
-name "*.rs" -exec touch {} +
RUN find backend/src types/src -name "*.rs" -exec touch {} +
RUN cargo build --release -p klog-backend