-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
78 lines (61 loc) · 2.4 KB
/
Copy pathDockerfile
File metadata and controls
78 lines (61 loc) · 2.4 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
# syntax=docker/dockerfile:1
# Builder stage
FROM rust:1-bookworm AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential clang cmake pkg-config git \
liblz4-dev zlib1g-dev libbz2-dev libsnappy-dev libzstd-dev \
protobuf-compiler ca-certificates && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
ENV ROCKSDB_BUILD_WITHOUT_GFLAGS=1 \
ROCKSDB_BUILD_WITHOUT_BENCHMARK_TOOLS=1 \
ROCKSDB_PORTABLE=1 \
ROCKSDB_DISABLE_AARCH64_CRC32=1 \
CXXFLAGS="-DROCKSDB_PORTABLE=1"
COPY Cargo.toml Cargo.toml
COPY crates/repo-core/Cargo.toml crates/repo-core/Cargo.toml
COPY crates/repo-index/Cargo.toml crates/repo-index/Cargo.toml
COPY crates/repo-ipfs/Cargo.toml crates/repo-ipfs/Cargo.toml
COPY crates/repo-node/Cargo.toml crates/repo-node/Cargo.toml
COPY crates/repo-cli/Cargo.toml crates/repo-cli/Cargo.toml
COPY crates/repo-proto/Cargo.toml crates/repo-proto/Cargo.toml
COPY crates/repo-proto/build.rs crates/repo-proto/build.rs
COPY proto proto
RUN mkdir -p \
crates/repo-core/src \
crates/repo-index/src \
crates/repo-ipfs/src \
crates/repo-node/src \
crates/repo-cli/src \
crates/repo-proto/src \
&& printf "pub fn _stub(){}\n" > crates/repo-core/src/lib.rs \
&& printf "pub fn _stub(){}\n" > crates/repo-index/src/lib.rs \
&& printf "pub fn _stub(){}\n" > crates/repo-ipfs/src/lib.rs \
&& printf "pub mod repo { tonic::include_proto!(\"repo\"); }\n" > crates/repo-proto/src/lib.rs \
&& printf "fn main(){}\n" > crates/repo-node/src/main.rs \
&& printf "fn main(){}\n" > crates/repo-cli/src/main.rs
RUN cargo fetch
COPY . .
RUN cargo build -p repo-node -p repo-cli --release
# Runtime stage
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
libstdc++6 libgcc-s1 \
liblz4-1 zlib1g libbz2-1.0 libsnappy1v5 libzstd1 \
ca-certificates tzdata \
busybox \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/target/release/repo-node /usr/local/bin/repo-node
COPY --from=builder /app/target/release/repo-cli /usr/local/bin/repo-cli
# COPY docker/start.sh /usr/local/bin/start.sh
# RUN chmod +x /usr/local/bin/start.sh
EXPOSE 50051
ENV RUST_LOG=info \
RUST_BACKTRACE=1 \
REPO_NODE_ADDR=0.0.0.0:50051 \
IPFS_BACKEND=kubo \
IPFS_API_URL=http://ipfs:5001
VOLUME ["/app/data"]
# ENTRYPOINT ["/usr/local/bin/start.sh"]
ENTRYPOINT ["/usr/local/bin/repo-node"]