Skip to content

Commit f2f89cb

Browse files
committed
Update devcontainer image to build from dojo image
1 parent a272195 commit f2f89cb

File tree

1 file changed

+41
-56
lines changed

1 file changed

+41
-56
lines changed

.devcontainer/Dockerfile

Lines changed: 41 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,60 @@
1-
# See here for image contents: https://hub.docker.com/layers/library/rust/1.81.0-slim/images/sha256-ba4ee661bb466ab49f6ceb8c6d9e9f9784bba7c6e45225187cd3c7fb1fbc12ce
2-
3-
ARG RUST_VERSION=1.81.0
4-
FROM rust:${RUST_VERSION}-slim
5-
ARG RUST_VERSION
6-
7-
# Install additional packages
8-
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
9-
&& apt-get -y install --no-install-recommends protobuf-compiler libprotobuf-dev libclang-dev libzstd-dev make pkg-config libssl-dev
10-
11-
RUN apt-get install -y gh libgmp3-dev software-properties-common curl git unzip
1+
ARG DOJO_IMAGE_TAG=v1.5.0-preview.0
2+
FROM ghcr.io/dojoengine/dojo:${DOJO_IMAGE_TAG}
3+
4+
ARG RUST_VERSION=1.85.0
5+
6+
# Base image does not seem to expose rustup in PATH for subsequent RUN commands.
7+
# Explicitly install Rust using rustup.
8+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${RUST_VERSION}
9+
ENV PATH="/root/.cargo/bin:${PATH}"
10+
11+
# Verify Rust installation
12+
RUN rustc --version
13+
RUN rustup --version
14+
15+
# Set non-interactive frontend for apt-get
16+
ENV DEBIAN_FRONTEND=noninteractive
17+
18+
# Install additional packages potentially not in the base image
19+
RUN apt-get update && apt-get install -y --no-install-recommends \
20+
protobuf-compiler \
21+
libprotobuf-dev \
22+
libclang-dev \
23+
libzstd-dev \
24+
make \
25+
git \
26+
gh \
27+
libgmp3-dev \
28+
software-properties-common \
29+
unzip \
30+
&& rm -rf /var/lib/apt/lists/*
1231

1332
RUN curl -fsSL https://bun.sh/install | bash && . /root/.bashrc
1433

1534
RUN curl -L https://foundry.paradigm.xyz/ | bash && . /root/.bashrc && foundryup
1635
ENV PATH="${PATH}:/root/.foundry/bin"
1736

18-
# To allow independent workflow of the container, the rust-toolchain is explicitely given.
19-
RUN echo ${RUST_VERSION} > rust_toolchain_version
20-
# Make sure to sync the nightly version with the scripts in ./scripts
21-
RUN echo "nightly-2024-08-28" > nightly_rust_toolchain_version
22-
23-
# Install cargo-binstall
24-
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
25-
26-
RUN rustup toolchain install $(cat rust_toolchain_version) && \
27-
rustup default $(cat rust_toolchain_version) && \
28-
rustup component add clippy && \
29-
rustup component add rustfmt
30-
31-
RUN rustup toolchain install $(cat nightly_rust_toolchain_version) && \
32-
rustup component add rustfmt clippy --toolchain $(cat nightly_rust_toolchain_version)
33-
37+
RUN rustup component add clippy rustfmt
3438
RUN rustup target add x86_64-pc-windows-msvc && \
3539
rustup target add wasm32-unknown-unknown
3640

37-
RUN cargo binstall cargo-get cargo-nextest cargo-llvm-cov cargo-release --secure -y
38-
39-
# Platform specific tooling
41+
# Platform specific tooling (hurl, llvm-tools)
4042
ARG TARGETPLATFORM
43+
44+
# Note: Assuming rustup is available in the base image for adding components
4145
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ] ; then \
4246
curl -L https://github.com/Orange-OpenSource/hurl/releases/download/4.1.0/hurl-4.1.0-aarch64-unknown-linux-gnu.tar.gz -o hurl.tar.gz && \
4347
tar -xzf hurl.tar.gz && \
44-
mv hurl-4.1.0-aarch64-unknown-linux-gnu/hurl /usr/local/bin/ && \
45-
rm -r hurl-4.1.0-aarch64-unknown-linux-gnu && \
48+
mv hurl-*-aarch64-unknown-linux-gnu/hurl /usr/local/bin/ && \
49+
rm -r hurl-*-aarch64-unknown-linux-gnu && \
4650
rm hurl.tar.gz && \
47-
rustup component add llvm-tools-preview --toolchain $(cat rust_toolchain_version)-aarch64-unknown-linux-gnu; \
51+
rustup component add llvm-tools-preview; \
4852
elif [ "$TARGETPLATFORM" = "linux/amd64" ] ; then \
4953
curl -L https://github.com/Orange-OpenSource/hurl/releases/download/4.1.0/hurl-4.1.0-x86_64-unknown-linux-gnu.tar.gz -o hurl.tar.gz && \
5054
tar -xzf hurl.tar.gz && \
51-
mv hurl-4.1.0-x86_64-unknown-linux-gnu/hurl /usr/local/bin/ && \
52-
rm -r hurl-4.1.0-x86_64-unknown-linux-gnu && \
55+
mv hurl-*-x86_64-unknown-linux-gnu/hurl /usr/local/bin/ && \
56+
rm -r hurl-*-x86_64-unknown-linux-gnu && \
5357
rm hurl.tar.gz && \
54-
rustup component add llvm-tools-preview --toolchain $(cat rust_toolchain_version)-x86_64-unknown-linux-gnu && \
55-
rustup target add x86_64-fortanix-unknown-sgx --toolchain $(cat nightly_rust_toolchain_version); \
58+
rustup component add llvm-tools-preview && \
59+
rustup target add x86_64-fortanix-unknown-sgx; \
5660
fi
57-
58-
ARG DOJO_VERSION=stable
59-
ARG BUILD_TYPE=default
60-
RUN curl -L https://install.dojoengine.org | bash
61-
RUN curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | bash
62-
ENV PATH=${PATH}:/root/.dojo/bin
63-
RUN if [ "$BUILD_TYPE" = "release" ]; then \
64-
echo "Installing Dojo version $DOJO_VERSION"; \
65-
dojoup -v $DOJO_VERSION; \
66-
elif [ "$BUILD_TYPE" = "push" ]; then \
67-
echo "Installing Dojo at commit $DOJO_VERSION"; \
68-
dojoup -c $DOJO_VERSION; \
69-
else \
70-
echo "Installing latest stable version of Dojo"; \
71-
dojoup; \
72-
fi
73-
74-
RUN chown -R root:root /usr/local/cargo
75-
RUN chmod -R 700 /usr/local/cargo

0 commit comments

Comments
 (0)