-
Notifications
You must be signed in to change notification settings - Fork 17
/
Dockerfile.multichain
36 lines (30 loc) · 1.38 KB
/
Dockerfile.multichain
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
FROM rust:latest as builder
RUN rustc --version --verbose
WORKDIR /usr/src/app
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install --no-install-recommends --assume-yes \
protobuf-compiler libprotobuf-dev
RUN echo "fn main() {}" > dummy.rs
COPY chain-signatures/node/Cargo.toml Cargo.toml
RUN sed -i 's#src/main.rs#dummy.rs#' Cargo.toml
RUN sed -i 's#mpc-keys = { path = "../keys" }##' Cargo.toml
RUN sed -i 's#mpc-contract = { path = "../contract" }##' Cargo.toml
RUN sed -i 's#crypto-shared = { path = "../crypto-shared" }##' Cargo.toml
RUN cargo build --release
COPY chain-signatures/. .
RUN sed -i 's#"keys",##' Cargo.toml
RUN sed -i 's#"contract",##' Cargo.toml
RUN sed -i 's#target-dir = "../target"#target-dir = "target"#' .cargo/config.toml
RUN cargo build --release --package mpc-node
FROM debian:stable-slim as runtime
RUN apt-get update && apt-get install --assume-yes libssl-dev ca-certificates curl redis-server
RUN update-ca-certificates
COPY --from=builder /usr/src/app/target/release/mpc-node /usr/local/bin/mpc-node
COPY chain-signatures/node/redis.conf /etc/redis/redis.conf
# Create a script to start both Redis and the Rust app
RUN echo "#!/bin/bash\nchown redis:redis /data\nservice redis-server start &\nexec mpc-node start" > /start.sh \
&& chmod +x /start.sh
WORKDIR /usr/local/bin
# Start Redis and the Rust application
ENTRYPOINT [ "/start.sh" ]