Allow the use of sudo in the docker container

This commit is contained in:
Manuel Thalmann 2022-03-23 09:01:48 +00:00
parent 9782d3499c
commit bb217047a1
2 changed files with 13 additions and 1 deletions

View file

@ -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

View file

@ -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