Build & Deployment
Build Your Container
Option 1: Snarkify command (recommended)
snarkify buildOption 2: Docker command
# Use a smaller, specific version of the Rust image for building
FROM --platform=linux/amd64 rust:latest AS builder
# Create a new empty project
RUN USER=root cargo new --bin snarkify
WORKDIR /snarkify
# Copy over your manifests
COPY ./Cargo.lock ./Cargo.toml ./
# Cache dependencies by building a dummy project
RUN cargo build --release && \
rm src/*.rs && \
rm ./target/release/deps/snarkify*
# Build your project for release
COPY ./src ./src
RUN cargo build --release
# Use a slim variant for the runtime stage to reduce size
FROM --platform=linux/amd64 ubuntu:22.04
# Copy the build artifact from the build stage
COPY --from=builder /snarkify/target/release/snarkify /usr/local/bin/snarkify
# Set the startup command to run your binary
CMD ["/usr/local/bin/snarkify"]Deploy Your Container
Last updated