diff --git a/.dockerignore b/.dockerignore index e522fed15..f7b76e7af 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,7 @@ +.git .devcontainer .github .vscode target specs -snapshot \ No newline at end of file +snapshot diff --git a/Dockerfile b/Dockerfile index 517fd6c99..803c22f67 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,34 +1,18 @@ -# **NOTE**: This docker file expects to be run in a directory outside of subspace. -# It also expects two build arguments, the bittensor snapshot directory, and the bittensor -# snapshot file name. +FROM rust:1.75-bookworm as build-env -# This runs typically via the following command: -# $ docker build -t subspace . --platform linux/x86_64 --build-arg SNAPSHOT_DIR="DIR_NAME" --build-arg SNAPSHOT_FILE="FILENAME.TAR.GZ" -f subspace/Dockerfile +RUN apt-get update +RUN apt-get install -y clang protobuf-compiler +WORKDIR /app +COPY . /app +RUN cargo build --release -FROM ubuntu:22.04 - -# This is being set so that no interactive components are allowed when updating. -ARG DEBIAN_FRONTEND=noninteractive -# show backtraces -ENV RUST_BACKTRACE 1 - -# Necessary libraries for Rust execution -RUN apt-get update && apt-get install -y curl build-essential protobuf-compiler clang git - -WORKDIR /subspace - -COPY ./scripts ./scripts -# Install cargo and Rust - -RUN apt-get update && apt-get install -y clang -ENV PATH="/root/.cargo/bin:${PATH}" -RUN ./scripts/install_rust_env.sh - -# Copy the source code -COPY . . -# Cargo build -RUN cargo build --release --locked - +# FROM gcr.io/distroless/cc +FROM debian:bookworm-slim +RUN apt-get update && \ + apt-get install -y zlib1g && \ + rm -rf /var/cache/apt/archives /var/lib/apt/lists/* +COPY --from=build-env /app/target/release/node-subspace /usr/local/bin +CMD ["node-subspace"]