|
| 1 | +# Dockerfile to reproduce locally an environment similar to what is run on the github runner |
| 2 | +# |
| 3 | +# From nautilus project's root folder: |
| 4 | +# |
| 5 | +# Build the image: |
| 6 | +# docker build -f .docker/DockerfileUbuntu -t nautilus-dev . |
| 7 | +# |
| 8 | +# Run interactively with local directory mounted: |
| 9 | +# docker run --rm -itv "$(pwd)":/workspace nautilus-dev bash |
| 10 | +# |
| 11 | +# Or run the default entrypoint: |
| 12 | +# docker run --rm -itv "$(pwd)":/workspace nautilus-dev |
| 13 | +# |
| 14 | +# Remove the image |
| 15 | +# docker image rm nautilus-dev |
| 16 | + |
| 17 | +FROM ubuntu:22.04 |
| 18 | + |
| 19 | +# Set environment variables |
| 20 | +ENV DEBIAN_FRONTEND=noninteractive |
| 21 | +ENV BUILD_MODE=release |
| 22 | +ENV RUST_BACKTRACE=1 |
| 23 | +ENV CARGO_INCREMENTAL=1 |
| 24 | +ENV CC="clang" |
| 25 | +ENV CXX="clang++" |
| 26 | + |
| 27 | +# Install system dependencies |
| 28 | +RUN apt-get update && apt-get install -y \ |
| 29 | + curl \ |
| 30 | + clang \ |
| 31 | + git \ |
| 32 | + pkg-config \ |
| 33 | + make \ |
| 34 | + capnproto \ |
| 35 | + libcapnp-dev \ |
| 36 | + gcc-aarch64-linux-gnu \ |
| 37 | + && rm -rf /var/lib/apt/lists/* |
| 38 | + |
| 39 | +# Install Rust |
| 40 | +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable |
| 41 | +ENV PATH="/root/.cargo/bin:${PATH}" |
| 42 | + |
| 43 | +# Install mold linker |
| 44 | +RUN curl -L https://github.com/rui314/mold/releases/download/v2.35.1/mold-2.35.1-x86_64-linux.tar.gz | tar -xz -C /usr/local --strip-components=1 |
| 45 | + |
| 46 | +# Install uv |
| 47 | +RUN curl -LsSf https://astral.sh/uv/install.sh | sh |
| 48 | +ENV PATH="/root/.cargo/bin:/root/.local/bin:${PATH}" |
| 49 | + |
| 50 | +# Install Python 3.13 |
| 51 | +RUN uv python install |
| 52 | + |
| 53 | +# Set working directory |
| 54 | +WORKDIR /workspace |
| 55 | + |
| 56 | +# Copy only necessary files for dependency setup |
| 57 | +# The actual source code will be mounted as a volume |
| 58 | +COPY ../scripts/rust-toolchain.sh scripts/ |
| 59 | +COPY ../Cargo.toml Cargo.lock pyproject.toml rust-toolchain.toml ./ |
| 60 | + |
| 61 | +# Set up Rust toolchain based on project requirements |
| 62 | +RUN bash scripts/rust-toolchain.sh > /tmp/toolchain.txt && \ |
| 63 | + TOOLCHAIN=$(cat /tmp/toolchain.txt) && \ |
| 64 | + rustup toolchain install $TOOLCHAIN && \ |
| 65 | + rustup default $TOOLCHAIN && \ |
| 66 | + rustup component add clippy rustfmt |
| 67 | + |
| 68 | +# Copy and set up entrypoint script for interactive development |
| 69 | +COPY .docker/entrypoint.sh /entrypoint.sh |
| 70 | +RUN chmod +x /entrypoint.sh |
| 71 | + |
| 72 | +ENTRYPOINT ["/entrypoint.sh"] |
0 commit comments