-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile.rust
More file actions
103 lines (84 loc) · 4.23 KB
/
Dockerfile.rust
File metadata and controls
103 lines (84 loc) · 4.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# syntax=docker/dockerfile:1.4
# deva.sh - Rust Developer Image
# Extends main deva image with Rust toolchain and ecosystem tools
ARG BASE_IMAGE=ghcr.io/thevibeworks/deva:latest
FROM ${BASE_IMAGE}
LABEL org.opencontainers.image.title="deva-rust"
LABEL org.opencontainers.image.description="Rust development environment with full toolchain"
ARG CLAUDE_CODE_VERSION=2.1.81
ARG CODEX_VERSION=0.116.0
ARG GEMINI_CLI_VERSION=0.35.0
ARG ATLAS_CLI_VERSION=v0.1.4
ARG RUST_TOOLCHAINS="stable"
ARG RUST_TARGETS="wasm32-unknown-unknown"
LABEL org.opencontainers.image.claude_code_version=${CLAUDE_CODE_VERSION}
LABEL org.opencontainers.image.codex_version=${CODEX_VERSION}
LABEL org.opencontainers.image.gemini_cli_version=${GEMINI_CLI_VERSION}
LABEL org.opencontainers.image.atlas_cli_version=${ATLAS_CLI_VERSION}
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV RUSTUP_HOME=/opt/rustup \
CARGO_HOME=/opt/cargo \
PATH=/opt/cargo/bin:$PATH
USER root
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get install -y --no-install-recommends \
libpq-dev postgresql-client \
libmysqlclient-dev mysql-client \
libsqlite3-dev sqlite3 \
libssl-dev \
libcurl4-openssl-dev \
libpng-dev libjpeg-dev \
libudev-dev \
libproc2-dev \
libzmq3-dev libzmq5 libczmq-dev && \
curl -fsSL 'https://packages.clickhouse.com/rpm/lts/repodata/repomd.xml.key' | gpg --dearmor -o /usr/share/keyrings/clickhouse-keyring.gpg && \
ARCH=$(dpkg --print-architecture) && \
echo "deb [signed-by=/usr/share/keyrings/clickhouse-keyring.gpg arch=${ARCH}] https://packages.clickhouse.com/deb stable main" > /etc/apt/sources.list.d/clickhouse.list && \
apt-get update && \
apt-get install -y --no-install-recommends clickhouse-client
RUN --mount=type=cache,target=/tmp/rust-cache,sharing=locked \
set -euxo pipefail && \
mkdir -p "$RUSTUP_HOME" "$CARGO_HOME" && \
mkdir -p "$CARGO_HOME/registry/cache" "$CARGO_HOME/registry/index" "$CARGO_HOME/git" && \
chown -R "$DEVA_UID:$DEVA_GID" "$RUSTUP_HOME" "$CARGO_HOME" && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
sh -s -- -y --default-toolchain none --profile default && \
rustup toolchain install ${RUST_TOOLCHAINS} && \
for tc in ${RUST_TOOLCHAINS}; do \
rustup component add --toolchain "$tc" rustfmt clippy rust-analyzer; \
done && \
if [ -n "${RUST_TARGETS}" ]; then \
for tc in ${RUST_TOOLCHAINS}; do \
rustup target add --toolchain "$tc" ${RUST_TARGETS}; \
done; \
fi && \
rustup default stable && \
chown -R "$DEVA_UID:$DEVA_GID" "$RUSTUP_HOME" "$CARGO_HOME"
RUN echo 'export PATH="/opt/cargo/bin:$PATH"' >> "$DEVA_HOME/.zshrc" && \
echo 'export RUSTUP_HOME=/opt/rustup' >> "$DEVA_HOME/.zshrc" && \
echo 'export CARGO_HOME=/opt/cargo' >> "$DEVA_HOME/.zshrc" && \
sed -i 's/plugins=(git docker python golang node npm aws/plugins=(git docker python golang rust node npm aws/' "$DEVA_HOME/.zshrc" && \
echo '# Rust aliases' >> "$DEVA_HOME/.zshrc" && \
echo 'alias cr="cargo run"' >> "$DEVA_HOME/.zshrc" && \
echo 'alias cb="cargo build"' >> "$DEVA_HOME/.zshrc" && \
echo 'alias ct="cargo test"' >> "$DEVA_HOME/.zshrc" && \
echo 'alias cc="cargo check"' >> "$DEVA_HOME/.zshrc" && \
echo 'alias cw="cargo watch -x check -x test -x run"' >> "$DEVA_HOME/.zshrc" && \
echo 'alias cf="cargo fmt"' >> "$DEVA_HOME/.zshrc" && \
echo 'alias cl="cargo clippy"' >> "$DEVA_HOME/.zshrc"
USER $DEVA_USER
COPY --chown=deva:deva scripts/install-agent-tooling.sh /tmp/install-agent-tooling.sh
RUN --mount=type=cache,target=/home/deva/.npm,uid=${DEVA_UID},gid=${DEVA_GID},sharing=locked \
bash /tmp/install-agent-tooling.sh && \
rm -f /tmp/install-agent-tooling.sh
USER root
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
COPY scripts/deva-bridge-tmux /usr/local/bin/deva-bridge-tmux
RUN chmod 755 /usr/local/bin/docker-entrypoint.sh && \
chmod 755 /usr/local/bin/deva-bridge-tmux && \
chmod -R 755 /usr/local/bin/scripts || true
WORKDIR /root
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/docker-entrypoint.sh"]
CMD ["claude"]