Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

Commit

Permalink
Merge pull request #9 from tsdataclinic/docker
Browse files Browse the repository at this point in the history
Add Docker file to standardize the development env of the app. Helpful for dev on Linux and Windows (also probably os x)
  • Loading branch information
kaushik12 authored Apr 26, 2019
2 parents 3353582 + 4c86b2e commit 46fce8a
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 4 deletions.
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM rocker/geospatial:3.5.0



RUN apt-get update; apt-get install -y inotify-tools

ADD . /app
WORKDIR /app
RUN Rscript ./newerhoods/setup.R

RUN chmod u+x entrypoint.sh
ENTRYPOINT /app/entrypoint.sh
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ Run the App
library(shiny)
runApp("newerhoods")
```
Alternatively, you can run the application in docker. To build the docker container run

```bash
docker build -t newerhoods .
```

Then to run the docker container simply run

```bash
docker run -it --rm -p 3000:3000 -v $(pwd):/app newerhoods
```

any changes you make in the code should trigger an application reload so all you should need to do is refresh your browser to see them.


### Contributing to NewerHoods

Expand Down
21 changes: 21 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

PORT=${2-3000}

start () {
R -e "source('newerhoods/settings_local.R'); shiny::runApp('newerhoods',port=$PORT, host='0.0.0.0')" &
PID=$!
}

start

inotifywait -mr newerhoods --format '%e %f' \
-e modify -e delete -e move -e create \
| while read event file; do

echo $event $file

kill $PID
start

done
11 changes: 7 additions & 4 deletions newerhoods/setup.R
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
require(devtools)
install.packages('lattice')
devtools::install_version("rgeos",version ='0.3-28')
### packages needed for the App

packages <- c("dplyr","readxl","shiny","shinyWidgets","shinyjs",
"leaflet","htmltools","shinyBS","shinythemes","markdown",
"shinycssloaders","rgeos","rgdal","maptools","sp","spdep",
"shinycssloaders","rgdal","maptools","sp","spdep",
"cluster","fpc","ClustGeo")

## installing required packages
install.packages(packages,quiet = TRUE)
install.packages(packages,quiet = FALSE)

## installing required packages
if (!require(gpclib)) {
install.packages("gpclib", type="source")
gpclibPermit()
require(gpclib)
#gcplib::gpclibPermit()
}

## installing the dev version of bsplus from GitHub
require(devtools)
devtools::install_github("ijlyttle/bsplus")


Expand Down

0 comments on commit 46fce8a

Please sign in to comment.