Skip to content

Commit

Permalink
Add defaults to arguments of container image Dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Doru Blânzeanu <[email protected]>
  • Loading branch information
dblnz committed Nov 13, 2024
1 parent 150821a commit 97fc75c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

FROM mcr.microsoft.com/devcontainers/base:debian AS base

ARG USER
ARG GROUP
ARG RUST_TOOLCHAIN
ARG USER=vscode
ARG GROUP=vscode
ARG RUST_TOOLCHAIN=1.81.0

ENV HOME="/home/${USER}"
ENV PATH="$HOME/.cargo/bin:$PATH"
Expand Down Expand Up @@ -37,21 +37,21 @@ RUN wget https://apt.llvm.org/llvm.sh \
FROM base AS dev

# Make sure the devcontainer user has sudo access
RUN chown -R "${USER}:$GROUP" /home/${USER} \
RUN chown -R "${USER}:${GROUP}" /home/${USER} \
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

# Persist bash hystory
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
&& mkdir /commandhistory \
&& touch /commandhistory/.bash_history \
&& chown -R $USER /commandhistory \
&& echo "$SNIPPET" >> "/home/$USER/.bashrc"
&& chown -R "${USER}" /commandhistory \
&& echo "$SNIPPET" >> "/home/${USER}/.bashrc"

USER $USER

# Install rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& rustup default $RUST_TOOLCHAIN \
&& rustup default ${RUST_TOOLCHAIN} \
&& rustup target add x86_64-unknown-linux-gnu \
&& rustup target add x86_64-unknown-none \
&& rustup target add x86_64-pc-windows-msvc \
Expand Down

0 comments on commit 97fc75c

Please sign in to comment.