Skip to content

Commit

Permalink
new Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
steinerkelvin committed Feb 5, 2024
1 parent d3f6622 commit acd05e1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 30 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.git
.devcontainer
.github
.vscode
target
specs
snapshot
snapshot
42 changes: 13 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit acd05e1

Please sign in to comment.