mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-30 00:00:11 +01:00
Add a non-root "villas" user to the dev container for VS Code
This allow proper translation of file permissions on a Linux machine. See https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user
This commit is contained in:
parent
544b40899c
commit
43965e3584
2 changed files with 15 additions and 2 deletions
|
@ -2,13 +2,14 @@
|
|||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/cpp
|
||||
{
|
||||
"name": "VILLASnode",
|
||||
"image": "registry.git.rwth-aachen.de/acs/public/villas/node/dev:master",
|
||||
"image": "registry.git.rwth-aachen.de/acs/public/villas/node/dev-vscode:master",
|
||||
// Uncomment to build the devcontainer locally
|
||||
// "build": {
|
||||
// "dockerfile": "../packaging/docker/Dockerfile.fedora",
|
||||
// "target": "dev",
|
||||
// "target": "dev-vscode",
|
||||
// "context": ".."
|
||||
// },
|
||||
"remoteUser": "villas",
|
||||
"runArgs": [ "--privileged", "--security-opt", "seccomp=unconfined"],
|
||||
|
||||
"extensions": [
|
||||
|
|
|
@ -103,6 +103,18 @@ ENV LANG C.UTF-8
|
|||
|
||||
WORKDIR /villas
|
||||
|
||||
FROM dev AS dev-vscode
|
||||
|
||||
# create a non-root user for vscode to use
|
||||
ARG USERNAME=villas
|
||||
ARG USER_UID=1000
|
||||
ARG USER_GID=$USER_UID
|
||||
|
||||
RUN groupadd --gid $USER_GID $USERNAME \
|
||||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
|
||||
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
|
||||
&& chmod 0440 /etc/sudoers.d/$USERNAME
|
||||
|
||||
FROM dev AS app
|
||||
|
||||
COPY . /villas/
|
||||
|
|
Loading…
Add table
Reference in a new issue