From c0f9d3d0ab1bc88224364675dd6d3314ec6743f7 Mon Sep 17 00:00:00 2001 From: Julian Pistorius Date: Fri, 23 Aug 2019 18:10:59 -0700 Subject: [PATCH 1/2] Created a Dockerfile for previewing docs locally --- Dockerfile | 24 ++++++++++++++++++++++++ README.md | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5e1a917 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM rocker/rstudio:latest + +RUN apt-get update \ + && apt-get install -y \ + libudunits2-dev \ + libgdal-dev + +RUN echo "alias l='ls -al'" >> /root/.bashrc + +RUN Rscript -e 'install.packages("blogdown")' +RUN Rscript -e 'install.packages("ggplot2")' +RUN Rscript -e 'install.packages("ggthemes")' +RUN Rscript -e 'install.packages("reticulate")' + +COPY . /terraref/tutorials + +WORKDIR /terraref/tutorials + +EXPOSE 3000 + +CMD Rscript -e 'bookdown::render_book("index.Rmd")' \ + && cd docs \ + && echo 'Starting a web server on http://localhost:3000/ to preview the documentation...' \ + && python -m SimpleHTTPServer 3000 \ No newline at end of file diff --git a/README.md b/README.md index 06c326c..b7b0c7d 100644 --- a/README.md +++ b/README.md @@ -39,3 +39,38 @@ Although we provide a few pre-configured computing environments, Workbench is de **To get started**, follow the [Workbench Quick Start](https://htmlpreview.github.io/?https://github.com/terraref/tutorials/blob/master/workbench/ndslabs_workbench_intro.html). This will walk you through the process of getting started with the first tutorials on how to access data. + + +## To generate this documentation locally + +If you would like to contribute to this documentation you can preview your +changes by running the following command: + +```bash +Rscript -e 'bookdown::render_book("index.Rmd")' +``` + +The output will be in the `docs` folder. + +There is also a Dockerfile for convenience. It requires installing Docker on +your computer: + +- [Docker for Mac](https://download.docker.com/mac/stable/Docker.dmg) +- [Docker for Windows](https://download.docker.com/win/stable/Docker%20for%20Windows%20Installer.exe) + +Build the image: + +```bash +docker build -t terraref-tutorials:local . +``` + +Run the container: + +```bash +docker run --rm -p 3000:3000 terraref-tutorials:tutorials +``` + +This will generate the documentation and start a local web server to preview +your changes. Open the preview URL in your browser: + +Run `docker kill tutorial-preview` to kill the web server container. \ No newline at end of file From 577de4650e38976d358de7a68ec911db7d5b50fa Mon Sep 17 00:00:00 2001 From: Julian Pistorius Date: Tue, 27 Aug 2019 10:41:51 -0700 Subject: [PATCH 2/2] Fixed a couple of bugs that @kimberlyh66 found during code review. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b7b0c7d..7a5914b 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ docker build -t terraref-tutorials:local . Run the container: ```bash -docker run --rm -p 3000:3000 terraref-tutorials:tutorials +docker run --rm -p 3000:3000 --name tutorial-preview terraref-tutorials:local ``` This will generate the documentation and start a local web server to preview