From bb217047a13d8d951c748a47e9d0b4e4bb9df965 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 23 Mar 2022 09:01:48 +0000 Subject: [PATCH] Allow the use of sudo in the docker container --- .devcontainer/docker-compose.yml | 4 +++- .devcontainer/web.Dockerfile | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/web.Dockerfile diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 7eb765d..7b81fa2 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -2,7 +2,9 @@ version: '3' services: silverstripe: - image: manuth/silverstripe-dev + build: + context: . + dockerfile: web.Dockerfile env_file: devcontainer.env environment: - SS_ENVIRONMENT_TYPE=dev diff --git a/.devcontainer/web.Dockerfile b/.devcontainer/web.Dockerfile new file mode 100644 index 0000000..2d0392a --- /dev/null +++ b/.devcontainer/web.Dockerfile @@ -0,0 +1,10 @@ +FROM manuth/silverstripe-dev + +RUN apt-get update && \ + apt-get -y install sudo && \ + rm -rf /var/lib/apt/lists/* + +RUN adduser --disabled-password --gecos '' vscode && \ + sed -i /etc/sudoers -re 's/^%sudo.*/%sudo ALL=(ALL:ALL) NOPASSWD: ALL/g' && \ + sed -i /etc/sudoers -re 's/^root.*/root ALL=(ALL:ALL) NOPASSWD: ALL/g' && \ + echo 'vscode ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers