FloSchuberth / cSEM

Composite-based SEM
https://floschuberth.github.io/cSEM/
GNU General Public License v3.0
28 stars 8 forks source link

Add Docker #502

Closed emstruong closed 1 year ago

emstruong commented 1 year ago

It could be helpful to use Docker in developing the package to ensure consistency between developers and to make it easier to diagnose issues.

M-E-Rademaker commented 1 year ago

I think it’s a bit of an overkill for the project. personally, i think tests combined with the currenrt CI infrastructure via GitHub actions is sufficient.

emstruong commented 1 year ago

I now agree, it's probably overkill and I'm also not convinced that it guarantees 'perfect' computational reproducibility, so it's a lot of work to still not have that guarantee. Furthermore, Dockerhub becomes a sort of dependency.

Either way, it's very short and easy to get up and running. As mentioned in the pull request, as long as two people build an image using the same Dockerfile at roughly the same time, the two containers should be very similar, if not identical.

To build the image, first go into the /docker directory in the terminal.

Then run sudo docker compose build

Then to run the image, do sudo --preserve-env=HOME docker compose up -d [1]

Based on my testing, --preserve-env=HOME is needed on Linux to pass your local rstudio preferences (Stored in your home folder and not /root/, presumably) to be mounted and used. If not needed, comment out the relevant line in the docker-compose file and simply run sudo docker compose up -d.

# The relevant line
- ${HOME}/.config/rstudio/rstudio-prefs.json:/home/rstudio/.config/rstudio/rstudio-prefs.json

Then open up a web browser and type in 0.0.0.0:8787 or any equivalent. Log-in is USERNAME: rstudio and PASSWORD: password. Go into project then open up the cSEM.Rproj.

[1] Passing HOME as shown by Pete Freitag https://www.petefreitag.com/item/877.cfm

FloSchuberth commented 1 year ago

@emstruong: I think this issue can be closed. If you agree please do so.

I think it would be nice to somewhere write a brief manual for docker, as you did in this issue. I see two options (i) a small wiki entry (I haven't done that before, but there is a wikipage: https://github.com/FloSchuberth/cSEM/wiki or (ii) as a new section at the bottom of the readme file: https://github.com/FloSchuberth/cSEM#readme. I am not sure which is the best place...

emstruong commented 1 year ago

@FloSchuberth I've made the wiki page

FloSchuberth commented 1 year ago

@emstruong : Thank you very much, this is very helpful!