From f0407d7f722db7858e9e0f3f365e0cd53e2a43bd Mon Sep 17 00:00:00 2001 From: babaolanqiu Date: Sat, 16 Nov 2024 04:50:42 +0000 Subject: [PATCH] chore: Add Dockerfile for custom Jupyter devcontainer configuration --- Dockerfile | 8 ++++++++ devcontainer.json | 13 ++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d53f62e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM quay.io/jupyter/r-notebook:latest + +USER root +# add ${NB_UID} to NOPASSWD sudoers +RUN echo "${NB_USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/added-by-start-script \ + echo "${NB_USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers + +USER ${NB_USER} \ No newline at end of file diff --git a/devcontainer.json b/devcontainer.json index da8ccd6..fcf6f54 100644 --- a/devcontainer.json +++ b/devcontainer.json @@ -1,12 +1,15 @@ { "name": "Data Science (Python and R)", - "image": "quay.io/jupyter/r-notebook:latest", + "build": { + // Path is relative to the devcontainer.json file. + "dockerfile": "Dockerfile" + }, // Features to add to the dev container. More info: https://containers.dev/features. "features": { "ghcr.io/h4rvey-g/rocker-devcontainer-features/r-apt:latest": { "vscodeRSupport": "full", "installRadian": true, - "installVscDebugger": true + "installVscDebugger": false } // "ghcr.io/h4rvey-g/rocker-devcontainer-features/apt-packages:1": { // "packages": "r-cran-data.table,r-cran-tidyverse", @@ -22,6 +25,10 @@ // ], // Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": "/bin/bash ./.devcontainer/postCreateCommand.sh", + // "RunArgs": [ + // "--user", + // "root" + // ], // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], // Configure tool-specific properties. @@ -62,4 +69,4 @@ }, // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "jovyan" -} +} \ No newline at end of file