From 40615067cf272788de6d9d6a889fcd2b88e5c212 Mon Sep 17 00:00:00 2001
From: Austin <pixelrazor@gmail.com>
Date: Tue, 3 Jan 2023 16:58:37 +0000
Subject: [PATCH] Add user for correct file perms

---
 .devcontainer/Dockerfile | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index 05dff76..f8a4fc4 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -1,10 +1,26 @@
 FROM rust:1.66
 
+ARG USERNAME=lldapdev
+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 \
+    && 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 apt update && \
     curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
     apt update && \
     apt install -y --no-install-recommends nodejs libssl-dev musl-dev make perl curl 
 
-RUN RUSTFLAGS=-Ctarget-feature=-crt-static cargo install wasm-pack cargo-chef \
+RUN RUSTFLAGS=-Ctarget-feature=-crt-static cargo install wasm-pack \
     && npm install -g rollup \
-    && rustup target add wasm32-unknown-unknown
\ No newline at end of file
+    && rustup target add wasm32-unknown-unknown
+
+USER $USERNAME
+ENV CARGO_HOME=/home/$USERNAME/.cargo
+ENV SHELL=/bin/bash
\ No newline at end of file