Skip to content

Commit

Permalink
Test alternative Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Robinlovelace committed Dec 17, 2021
1 parent 57e06af commit 13b9717
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 70 deletions.
21 changes: 21 additions & 0 deletions .binder/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM rocker/binder:4.1.2

## Declares build arguments
ARG NB_USER
ARG NB_UID

COPY --chown=${NB_USER} . ${HOME}

ENV DEBIAN_FRONTEND=noninteractive
USER root
RUN echo "Checking for 'apt.txt'..." \
; if test -f "apt.txt" ; then \
apt-get update --fix-missing > /dev/null\
&& xargs -a apt.txt apt-get install --yes \
&& apt-get clean > /dev/null \
&& rm -rf /var/lib/apt/lists/* \
; fi
USER ${NB_USER}

## Run an install.R script, if it exists.
RUN if [ -f install.R ]; then R --quiet -f install.R; fi
29 changes: 29 additions & 0 deletions .binder/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2021, Yuvi Panda
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45 changes: 45 additions & 0 deletions .binder/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Template for RStudio on Binder / JupyterHub

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/yuvipanda/rstudio-binder-template/HEAD?urlpath=rstudio)

Generate a Git repository that can run R code with RStudio on
the browser via [mybinder.org](https://mybinder.org) or any JupyterHub
from this template repository!

Based on the excellent [rocker/binder](https://hub.docker.com/r/rocker/binder)
image maintained by the [Rocker project](https://www.rocker-project.org/)

## How to use this reop

### 1. Create a new repo using this as a template

Use the [Use this template](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template#creating-a-repository-from-a-template)
button on GitHub. Use a descriptive name representing the
GUI app you are running / demoing. You can then follow the rest of
the instructions in this README from your newly created repository.

### 2. Install any packages you want

You can create an `install.R` file that will be executed on build.
Use `install.packages` or `devtools::install_version`.

```R
install.packages("ggplot2")
```

Packages are installed from [packagemanager.rstudio.com](https://packagemanager.rstudio.com/client/#/),
and binary packages are preferred wherever possible. For some R packages,
you might need to install system packages via apt - you can do so by writing
out a list of apt package names in `apt.txt`.

### 3. Modify the Binder Badge in the README.md

The 'Launch on Binder' badge in this README points to the template repository.
You should modify it to point to your own repository. Keep the `urlpath=rstudio`
parameter intact - that is what makes sure your repo will launch directly into
RStudio

### 4. Add your R code and update README

Finally, add the R code you want to demo to the repository! Cleanup the README
too so it talks about your code, not these instructions on setting up this repo
2 changes: 1 addition & 1 deletion .binder/apt.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
libprotobuf-dev
vim
40 changes: 0 additions & 40 deletions .binder/environment.yml

This file was deleted.

1 change: 1 addition & 0 deletions .binder/install.R
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
install.packages("ggplot2")
14 changes: 0 additions & 14 deletions .binder/install_extra.R

This file was deleted.

1 change: 0 additions & 1 deletion .binder/postBuild

This file was deleted.

14 changes: 0 additions & 14 deletions .binder/start

This file was deleted.

0 comments on commit 13b9717

Please sign in to comment.