Skip to content

Commit

Permalink
chore: update dev container
Browse files Browse the repository at this point in the history
  • Loading branch information
iosh committed Oct 7, 2024
1 parent e8a8a4d commit d7ed99c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 13 deletions.
38 changes: 27 additions & 11 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
FROM ubuntu:22.04

RUN apt-get update && apt-get install curl lsb-release wget software-properties-common gnupg -y

ARG USERNAME=user-name-goes-here
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

RUN sudo apt-get update && sudo apt-get install curl lsb-release wget software-properties-common gnupg -y
RUN wget https://apt.llvm.org/llvm.sh && chmod u+x llvm.sh && ./llvm.sh 18
RUN sudo apt-get install -y libsqlite3-dev pkg-config libssl-dev cmake libc++-18-dev git curl unzip

RUN apt-get install -y libsqlite3-dev pkg-config libssl-dev cmake libc++-18-dev git curl unzip
USER ${USERNAME}

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
. ~/.bashrc && \
rustup target add x86_64-unknown-linux-gnu
WORKDIR /home/${USERNAME}

RUN curl -fsSL https://fnm.vercel.app/install | bash && \
. ~/.bashrc && \
fnm use --install-if-missing 20 && \
npm install pnpm -g
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y && \
. "$HOME/.cargo/env"

RUN git clone --depth 1 --single-branch --branch v0.40.1 https://github.com/nvm-sh/nvm.git .nvm && \
echo 'export NVM_DIR="$HOME/.nvm"' >> $HOME/.bashrc && \
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $HOME/.bashrc && \
echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"' >> $HOME/.bashrc && \
. $HOME/.bashrc && \
export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && \
nvm install 20 && npm install -g pnpm




ENV PATH="/root/.cargo/bin:${PATH}"
ENV CC=clang-18
ENV CXX=clang++-18
ENV CXXFLAGS="-std=c++11 -stdlib=libc++"
Expand Down
12 changes: 10 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"build": { "dockerfile": "Dockerfile" },
"build": {
"dockerfile": "Dockerfile",
"args": {
"USERNAME": "${localEnv:USER}",
"USER_UID": "${localEnv:REMOTE_UID:1000}",
"USER_GID": "${localEnv:REMOTE_GID:1000}"
}
},
"customizations": {
"vscode": {
"settings": {},
Expand All @@ -9,5 +16,6 @@
"vitest.explorer"
]
}
}
},
"remoteUser": "${localEnv:USER}"
}

0 comments on commit d7ed99c

Please sign in to comment.