Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Dockerfile #15

Merged
merged 2 commits into from
Feb 27, 2023
Merged

add Dockerfile #15

merged 2 commits into from
Feb 27, 2023

Conversation

slager
Copy link
Contributor

@slager slager commented Feb 24, 2023

[If this doesn't interfere with the package build and CRAN checks] it's a nice reproducible way to get the packages up and running on any machine with the same package environments for future troubleshooting purposes. Planning to do my initial testing/etc using this environment.

@ethanplunkett
Copy link
Contributor

Cool! It passes the check but adds a note about non-standard files, so I think we should add the Docker file to .rbuildignore. Unless that defeats the purpose of adding it? People using the Docker file will pull the repository and then open it from there - not try to access it from a built package, right?

Assuming your ok with that change would you prefer to update the pull request or for me to merge and then make the change?

@slager
Copy link
Contributor Author

slager commented Feb 25, 2023

Yes, good point. Having the Dockerfile in the repo but ignored by the package build seems good. Looks like at least a few other people have been thinking that as well:

https://stackoverflow.com/questions/46122024/where-to-put-a-dockerfile-in-an-r-package

I pushed a commit to this effect to this feature branch.

I'm guessing you're familiar with Docker already but just to have it documented in here for anyone who eventually needs it, here's how one can use the Dockerfile in Linux/MacOS (Windows should be similar):

  1. Go to the top level BirdFlowR directory, build the image from the Dockerfile, and tag the image as 'birdflow'. It will take a long time the first time because it will need to download the rocker/geospatial:4.2.2 image from Docker Hub, which is the starting point before we install our custom packages via the Dockerfile. For future builds on the same machine, rocker/geospatial will already be cached by Docker, so all it needs to do to is re-install our custom packages. The build step really only needs to happen when you want to use a newer version of the BirdFlowR repo. See also: https://rocker-project.org/images/versioned/rstudio.html
docker build -t birdflow .
  1. Launch a Docker container from the image, and launch an RStudio Server instance from the container. If you're doing it locally on your computer, you can use this version to skip the password. Specifying the IP address in this way should make it only accessible from the same computer, according to the Rocker page.
docker run --rm -ti -e DISABLE_AUTH=true -p 127.0.0.1:8787:8787 birdflow

If you're doing it between computers, make sure to only include the ports, and require authentication:

docker run --rm -ti -e PASSWORD=yourpassword -p 8787:8787 birdflow
  1. Once you see the message saying services are started, point your web browser here to use RStudio from the image.
localhost:8787/
  1. When you're done, go back to the terminal window that started the docker services, and hit Control-C. This will send a kill signal to the container that is supporting the RStudio server process.

  2. the Rocker webpage shows some ways to persist directories and settings between the container and host as well, so that you don't lose your Rstudio settings and local work each time you launch/close a container.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants