diff --git a/Dockerfile b/Dockerfile index 2be1708..1a97228 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,4 +47,15 @@ COPY install_packages.R /workspace/ RUN Rscript install_packages.R -CMD /usr/lib/rstudio-server/bin/rserver --server-daemonize=0 \ No newline at end of file +# CMD /usr/lib/rstudio-server/bin/rserver --server-daemonize=0 + +# Install supervisord +RUN apt-get install -y supervisor + +# Copy supervisord configuration file +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +# Expose Jupyter Notebook port +EXPOSE 8888 + +CMD ["/usr/bin/supervisord"] \ No newline at end of file diff --git a/README.md b/README.md index d1f21de..fca0e39 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ docker run --platform linux/amd64 -it --rm \ -v $(pwd)/data:/workspace/data \ -v $(pwd)/code:/workspace/code \ -p 8787:8787 \ + -p 8888:8888 \ python-r-env ``` ### Usage @@ -41,15 +42,27 @@ docker run --platform linux/amd64 -it --rm \ 3. From the opened context menu select your container. 4. You're in your `workspace` directory, the parent directory of `code/` and `data/`. -#### RStudi Server for R +#### RStudio Server for R - You can access RStudio Server at `http://localhost:8787`. - Login credentials are `rstudio` for both username and password (without quotes). - You're in your `workspace` directory, the parent directory of `code/` and `data/`. +#### Jupyter Notebook +- You can access Jupyter Notebook at `http://localhost:8888`. +- The access credentials are disabled in the `supervisord.conf` file. You can enable it by removing the `--NotebookApp.token=''` and `--NotebookApp.password=''` flag from the `supervisord.conf` file. + ### Customization - **Adding Python Packages**: Update the `requirements.txt` file with the required packages. - **Adding R Packages**: Update the `install_packages.R` file with the required packages. +# On Windows (UNTESTED) +Delete the `--platform linux/amd64` flag from the `docker run` command. +Delete the below from the `devcontainer.json` file: +```sh +"options": [ + "--platform=linux/amd64" + ] +``` \ No newline at end of file diff --git a/install_packages.R b/install_packages.R index 26bd8f8..10c2ecc 100644 --- a/install_packages.R +++ b/install_packages.R @@ -1,2 +1,2 @@ -install.packages("dplyr") -install.packages("ggplot2") +# commented out for speed in testing +# install.packages("ggplot2") diff --git a/requirements.txt b/requirements.txt index f30f7b3..e990a8d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ numpy pandas matplotlib - +jupyter diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 0000000..49fd701 --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,17 @@ +[supervisord] +nodaemon=true + +[program:rstudio-server] +command=/usr/lib/rstudio-server/bin/rserver --server-daemonize=0 +autostart=true +autorestart=true +stderr_logfile=/var/log/rstudio-server.err.log +stdout_logfile=/var/log/rstudio-server.out.log + +[program:jupyter-notebook] +command=jupyter notebook --allow-root --ip="*" --port=8888 --no-browser --NotebookApp.token='' --NotebookApp.password='' --notebook-dir=/workspace +directory=/workspace +autostart=true +autorestart=true +stderr_logfile=/var/log/jupyter.err.log +stdout_logfile=/var/log/jupyter.out.log \ No newline at end of file