Skip to content

Commit 07613b5

Browse files
committed
Migrate refactor of catalog to rust
1 parent 70fa07d commit 07613b5

File tree

22 files changed

+3149
-1294
lines changed

22 files changed

+3149
-1294
lines changed

.docker/DockerfileUbuntu

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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"]

.docker/entrypoint.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
# entrypoint script for DockerfileUbuntu
3+
4+
echo "=== Nautilus Trader Development Environment ==="
5+
echo "Rust version: $(rustc --version)"
6+
echo "UV version: $(uv --version)"
7+
echo "Working directory: $(pwd)"
8+
echo
9+
10+
echo "=== Setting PyO3 environment ==="
11+
export PYO3_PYTHON=/workspace/.venv/bin/python3
12+
echo "PYO3_PYTHON: $PYO3_PYTHON"
13+
echo
14+
15+
echo "=== Development environment ready! ==="
16+
echo "You can now run for example:"
17+
echo " make install-debug # Install nautilus in debug mode"
18+
echo " make cargo-test # Test Rust code"
19+
echo " make pytest # Run Python tests"
20+
echo " uv run python -c \"import nautilus_trader.backtest.engine;\" # Run a Python instruction"
21+
echo
22+
23+
# If no command is provided, check if we have a TTY and start appropriate shell
24+
if [ $# -eq 0 ]; then
25+
if [ -t 0 ]; then
26+
echo "Starting interactive shell..."
27+
exec bash
28+
else
29+
echo "No TTY detected. Use docker run -it for interactive mode."
30+
echo "Container ready for commands. Example:"
31+
echo " docker run --rm -itv \"\$(pwd)\":/workspace nautilus-dev"
32+
fi
33+
else
34+
exec "$@"
35+
fi

0 commit comments

Comments
 (0)