-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
87 lines (68 loc) · 2.37 KB
/
Dockerfile
File metadata and controls
87 lines (68 loc) · 2.37 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Multi-stage Dockerfile for Roxy Price (Linera Application)
# Based on Linera buildathon template requirements
# Build stage
FROM rust:1.86.0-slim as builder
# Install build dependencies including Linera requirements
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
protobuf-compiler \
curl \
git \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Set working directory (template uses /build)
WORKDIR /build
# Copy manifest files
COPY Cargo.toml Cargo.lock ./
COPY rust-toolchain.toml ./
# Copy config file (if it exists)
COPY config.json* ./
# Copy source code
COPY src ./src
# Copy tests directory (needed for cargo build)
COPY tests ./tests
# Install wasm32 target
RUN rustup target add wasm32-unknown-unknown
# Build the project
RUN cargo build --release --target wasm32-unknown-unknown
# Build native binaries for testing
RUN cargo build --release
# Runtime stage - includes Linera CLI and dependencies
# Note: We need Rust/Cargo in runtime stage for run.bash to build
FROM rust:1.86.0-slim
# Install runtime dependencies including Linera CLI requirements
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
bash \
procps \
pkg-config \
libssl-dev \
protobuf-compiler \
libclang-dev \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install wasm32 target for run.bash builds
RUN rustup target add wasm32-unknown-unknown
# Install Linera CLI using cargo (as per https://linera.dev/developers/getting_started/installation.html)
# Install linera-storage-service and linera-service
# Note: Docker layer caching means this only installs once unless Dockerfile changes
RUN cargo install --locked [email protected] && \
cargo install --locked [email protected]
# Create build directory (template requirement)
WORKDIR /build
# Copy built artifacts from builder
COPY --from=builder /build/target/wasm32-unknown-unknown/release/*.wasm ./
COPY --from=builder /build/target/release/predictive_manager_contract ./
COPY --from=builder /build/target/release/predictive_manager_service ./
# Copy config.json if it exists (optional)
COPY --from=builder /build/config.json* ./
# Copy run.bash script
COPY run.bash ./
RUN chmod +x run.bash
# Set environment variables
ENV RUST_LOG=info
ENV RUST_BACKTRACE=1
# Default command (will be overridden by compose.yaml)
CMD ["/bin/bash", "run.bash"]