Skip to content

Commit 699d876

Browse files
authored
Create Dockerfile.dev
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
1 parent 65f8e48 commit 699d876

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

.devcontainer /Dockerfile.dev

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
FROM ubuntu:22.04
2+
3+
ARG USERNAME=foundry
4+
ARG USER_UID=1000
5+
ARG USER_GID=$USER_UID
6+
ARG PYTHON_VERSION=3.14
7+
ARG NODE_MAJOR=20
8+
ARG VYPER_VERSION=0.4.3
9+
10+
ENV DEBIAN_FRONTEND=noninteractive
11+
ENV CARGO_TERM_COLOR=always \
12+
RUST_BACKTRACE=full
13+
14+
WORKDIR /workspace
15+
16+
RUN apt-get update && apt-get install -y --no-install-recommends \
17+
# Build tools
18+
build-essential \
19+
clang \
20+
lld \
21+
pkg-config \
22+
# Network/SSL
23+
curl \
24+
ca-certificates \
25+
gnupg \
26+
libssl-dev \
27+
# Version control & utils
28+
git \
29+
sudo \
30+
unzip \
31+
# Python
32+
python${PYTHON_VERSION} \
33+
python3-pip \
34+
python${PYTHON_VERSION}-venv \
35+
# Add Node.js repo
36+
&& mkdir -p /etc/apt/keyrings \
37+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
38+
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
39+
# Update again after adding repo and install Node.js
40+
&& apt-get update && apt-get install -y --no-install-recommends \
41+
nodejs \
42+
# Clean up apt cache
43+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
44+
45+
# Ensure python points to the installed python version
46+
RUN ln -sf /usr/bin/python${PYTHON_VERSION} /usr/bin/python && \
47+
ln -sf /usr/bin/python${PYTHON_VERSION} /usr/bin/python3
48+
49+
# Create non-root user with sudo privileges
50+
RUN groupadd --gid $USER_GID $USERNAME \
51+
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash \
52+
# Setup sudo without password prompt
53+
&& echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME \
54+
&& chmod 0440 /etc/sudoers.d/$USERNAME \
55+
# Add user to the sudo group (standard practice)
56+
&& usermod -aG sudo $USERNAME
57+
58+
# Switch to the non-root user
59+
USER $USERNAME
60+
WORKDIR /home/$USERNAME
61+
62+
# --- User-specific installations ---
63+
64+
# Install Bun
65+
ENV BUN_INSTALL="/home/$USERNAME/.bun"
66+
ENV PATH="$BUN_INSTALL/bin:$PATH"
67+
RUN curl -fsSL https://bun.sh/install | bash
68+
69+
# Install Rust & cargo-nextest
70+
ENV CARGO_HOME="/home/$USERNAME/.cargo"
71+
ENV RUSTUP_HOME="/home/$USERNAME/.rustup"
72+
ENV PATH="$CARGO_HOME/bin:$PATH"
73+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
74+
&& cargo install cargo-nextest --locked
75+
76+
# Install Vyper using pip
77+
# Ensure pip user install directory is in PATH
78+
ENV PYTHONUSERBASE="/home/$USERNAME/.local"
79+
ENV PATH="$PYTHONUSERBASE/bin:$PATH"
80+
RUN pip3 install --user vyper==${VYPER_VERSION}
81+
82+
# Switch back to the main workspace directory
83+
WORKDIR /workspace

0 commit comments

Comments
 (0)