RamiKrispin / vscode-r

A Tutorial for Setting R Development Environment with VScode, Dev Containers, and Docker
240 stars 28 forks source link

Using postStartCommand instead of postCreateCommand #15

Closed jaredlander closed 2 months ago

jaredlander commented 3 months ago

Since we want radian to launch every time the container is run, not just after creation, use postStartCommand instead of postCreateCommand.

RamiKrispin commented 2 months ago

Thanks!

jaredlander commented 2 months ago

I've been playing around and depending on the size of the image there can be problems with this command not finding the .R files the R extension adds to the workspace. I find that these modifications work, though I haven't made a PR for it yet.

"postStartCommand": "until [ -f /root/.vscode-R/init.R ]; do sleep 0.1; done; radian",                                                  "containerEnv": {
  "R_PROFILE_USER": "/root/.Rprofile",
  "TERM_PROGRAM": "vscode",
  "VSCODE_INIT_R": "R/session/init.R"
},
RamiKrispin commented 2 months ago

Thanks! Tested on the temlate, this fix the issue with the plot viewer. I will try to add those environment variable to the base image.

RamiKrispin commented 2 months ago

I updated the Dockerfile on the GitHub template, works smoothly so far. I will update the tutorial in the coming weeks. Thanks!