Dockerfile49 lines · 1198 chars # Multi-stage build for Nushell (nu) from source on Ubuntu Jammy
FROM ubuntu:22.04 AS builder
# Install build dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
build-essential \
clang \
pkg-config \
libsqlite3-dev \
openssl \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Rust toolchain 1.92.0 (per Cargo.toml rust-version)
ENV RUSTUP_HOME=/root/.rustup \
CARGO_HOME=/root/.cargo \
PATH=/root/.cargo/bin:$PATH
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.92.0
WORKDIR /workspace
# Copy source and build
COPY . .
# Build the nushell binary specifically to speed up the build
RUN cargo build -p nu --release
FROM ubuntu:22.04 AS runtime
# Runtime dependencies (minimal)
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
libsqlite3-0 \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /workspace/target/release/nu /usr/local/bin/nu
RUN chmod +x /usr/local/bin/nu
ENTRYPOINT ["/usr/local/bin/nu"]