1- FROM ubuntu:22 .04
1+ FROM ubuntu:24 .04
22
3- ARG USERNAME=developer
4- ARG USER_UID=1000
5- ARG USER_GID=$USER_UID
3+ ARG USERNAME=ubuntu
4+ ARG VERSION_MXPY="11.3.1"
5+ ARG VERSION_RUST="1.90.0"
6+ ARG VERSION_SC_META="0.64.2"
67
7- ARG VERSION_MXPY="v11.1.1"
8- ARG VERSION_RUST="1.86.0"
9- ARG VERSION_SC_META="0.62.0"
8+ ENV DEBIAN_FRONTEND=noninteractive
109
11- # Create the user
12- RUN groupadd --gid $USER_GID $USERNAME \
13- && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
14- #
15- # [Optional] Add sudo support. Omit if you don't need to install software after connecting.
16- && apt-get update \
17- && apt-get install -y sudo \
18- && echo $USERNAME ALL=\( root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
19- && chmod 0440 /etc/sudoers.d/$USERNAME
20-
21- # Install some dependencies as root
10+ # Base system dependencies
2211RUN apt-get update && apt-get install -y \
23- wget \
24- build-essential \
25- python3.10 python3-pip python3.10-venv \
12+ sudo \
13+ curl \
2614 git \
15+ build-essential \
2716 pkg-config \
28- libssl-dev && \
29- rm -rf /var/lib/apt/lists/*
30-
31- # Switch to regular user
32- USER $USERNAME
17+ libssl-dev \
18+ python3 \
19+ python3-venv \
20+ python3-pip \
21+ pipx \
22+ ca-certificates \
23+ && rm -rf /var/lib/apt/lists/*
24+
25+ # Give sudo access to the user without password
26+ RUN echo ${USERNAME} ALL=\( root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
27+ && chmod 0440 /etc/sudoers.d/${USERNAME}
28+
29+ USER ${USERNAME}
3330WORKDIR /home/${USERNAME}
3431
32+ # Environment variables
3533ENV MULTIVERSX="/home/${USERNAME}/multiversx-sdk"
3634ENV PATH="/home/${USERNAME}/.local/bin:${PATH}"
3735ENV PATH="/home/${USERNAME}/.cargo/bin:${PATH}"
3836
39- # Install pipx
40- RUN python3 -m pip install --no-cache-dir --user pipx
41-
42- # Install mxpy
37+ # Install mxpy via pipx
4338RUN pipx install multiversx-sdk-cli==${VERSION_MXPY}
4439
45- # Install rust
46- RUN wget -O rustup.sh https://sh.rustup.rs && \
47- chmod +x rustup.sh && \
48- CARGO_HOME=/home/${USERNAME}/.cargo RUSTUP_HOME=/home/${USERNAME}/.rustup ./rustup.sh --verbose --default-toolchain ${VERSION_RUST} --profile minimal -y && \
49- rm rustup.sh
40+ # Install Rust
41+ RUN curl https://sh.rustup.rs -sSf | \
42+ sh -s -- -y --profile minimal --default-toolchain ${VERSION_RUST}
5043
5144# Install sc-meta tools
52- RUN CARGO_HOME=/home/${USERNAME}/.cargo RUSTUP_HOME=/home/${USERNAME}/.rustup PATH="/home/${USERNAME}/.cargo/bin:${PATH}" \
53- cargo install multiversx-sc-meta --version ${VERSION_SC_META} --locked
54-
55- RUN CARGO_HOME=/home/${USERNAME}/.cargo RUSTUP_HOME=/home/${USERNAME}/.rustup PATH="/home/${USERNAME}/.cargo/bin:${PATH}" \
56- sc-meta install all
45+ RUN cargo install multiversx-sc-meta --version ${VERSION_SC_META} --locked \
46+ && sc-meta install all
5747
5848# Install test wallets
59- RUN mxpy deps install testwallets && rm ${MULTIVERSX}/*.tar.gz
49+ RUN mxpy deps install testwallets
50+
51+ # Rust components + cleanup
52+ RUN rustup component add rustfmt \
53+ && rm -rf /home/${USERNAME}/.cargo/registry \
54+ && rm -rf /home/${USERNAME}/.cargo/git
6055
61- RUN rustup component add rustfmt && rm -rf /home/${USERNAME}/.cargo/registry/* && rm -rf /home/${USERNAME}/.cargo/git/*
56+ # Devcontainer resources
57+ COPY post_create_command.py ${MULTIVERSX}/devcontainer-resources/
6258
63- # This command will be executed once the devcontainer is created
64- COPY "post_create_command.py" "${MULTIVERSX}/devcontainer-resources/"
59+ CMD ["bash" ]
0 commit comments