Files
bridge/mpc-nodes/docker/services/mpc-node
T
2024-12-04 02:20:35 +08:00

44 lines
1015 B
Plaintext

# Use Rust as the base image
FROM rust:latest AS rust_builder
# Set the working directory
WORKDIR /app
# Copy the Rust source code
COPY ./common/multiparty_ecdsa .
# Install necessary dependencies
RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*
# Install nightly version of Rust and set it as the default toolchain
RUN rustup install nightly
RUN rustup default nightly
# Ensure the nightly toolchain is being used
RUN rustc --version # This should print nightly version details
# Build your Rust application
RUN cargo build --release --examples
# Use Node.js for the final image
FROM node:20
# Set working directory in Node container
WORKDIR /app
COPY ./common/node .
# Install Node.js dependencies
RUN npm install
# Build node app
RUN npm run build
# Copy the built Rust binary from the builder stage
COPY --from=rust_builder /app/. ./dist/multiparty
EXPOSE 6000
# Command to run the application (adjust as necessary)
CMD ["node", "dist/node.js"]