Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fcf2f7c

Browse files
authored
Merge pull request rpodcast#28 from rpodcast/composetweak
Composetweak
2 parents 466b864 + 7aeebad commit fcf2f7c

14 files changed

Lines changed: 846 additions & 150 deletions

File tree

.devcontainer/.env

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
INSTALL_ZSH=false
32
INSTALL_FISH=true
43
UPGRADE_PACKAGES=true
@@ -10,9 +9,8 @@ USERID=1000
109
GROUPID=1000
1110
PASSWORD=1rstudio
1211
VOLUME_PATH=/home/eric/r_dev_projects
13-
LOCAL_PORT=2009
14-
CONTAINER_NAME=rstudioquarto
12+
LOCAL_PORT=2010
1513
QUARTO_VERSION=latest
1614
RSTUDIO_VERSION=2022.02.1-461
1715
S6_VERSION=v1.21.7.0
18-
COMPOSE_PROJECT_NAME=rdevprojects
16+
COMPOSE_PROJECT_NAME=rdevprojects

.devcontainer/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,17 @@ ARG INSTALL_OHMYZSH="false"
1515
ARG INSTALL_NONFREE="false"
1616
ARG QUARTO_VERSION=latest
1717

18-
# [Optional] Uncomment this section to install additional OS packages.
1918
# key dependencies for certain R packages
2019
RUN apt-get update \
2120
&& export DEBIAN_FRONTEND=noninteractive \
22-
&& apt-get -y install --no-install-recommends software-properties-common wget libssl-dev libxml2-dev libcurl4-openssl-dev python3-pip pandoc libzip-dev \
23-
&& apt-get -y install --no-install-recommends libfreetype6-dev libfontconfig1-dev tk \
21+
&& apt-get -y install --no-install-recommends software-properties-common curl wget libssl-dev libxml2-dev libsodium-dev imagemagick libmagick++-dev libgit2-dev libssh2-1-dev zlib1g-dev librsvg2-dev libudunits2-dev libcurl4-openssl-dev python3-pip pandoc libzip-dev libfreetype6-dev libfontconfig1-dev tk libpq5 libxt6 openssh-client openssh-server \
2422
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
2523

2624
COPY library-scripts/common-debian.sh /tmp/library-scripts/
2725
RUN apt-get update && bash /tmp/library-scripts/common-debian.sh ${INSTALL_ZSH} ${USERNAME} ${USER_UID} ${USER_GID} ${UPGRADE_PACKAGES} ${INSTALL_OHMYZSH} ${INSTALL_NONFREE}
2826

2927
# install R packages needed for VSCode interaction and package management
30-
RUN install2.r languageserver renv remotes httpgd
28+
RUN install2.r --error --skipinstalled --ncpus -4 languageserver renv remotes httpgd
3129

3230
# install radian via python and pip3
3331
RUN apt-get update \

.devcontainer/devcontainer.json

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,10 @@
55
"dockerComposeFile": "docker-compose.yml",
66
"workspaceFolder": "/workspace",
77
"service": "vscode",
8-
//"build": {
9-
// "dockerfile": "Dockerfile",
10-
// "args": {
11-
// "USERNAME": "${localEnv:USER}",
12-
// "QUARTO_VERSION": "${localEnv:QUARTO_VERSION}"
13-
// }
14-
//},
15-
// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined", "--env-file", ".devcontainer/.env" ],
168

17-
// Add more local mounts to container
18-
// The first mounts are for a local pulseaudio server on linux
19-
// You can leave these commented out or delete if you are not linking the contianer to a linux sound system
20-
// "mounts": [
21-
//"source=/etc/alsa,target=/etc/alsa,type=bind,consistency=cached",
22-
//"source=/usr/share/alsa,target=/usr/share/alsa,type=bind,consistency=cached",
23-
//"source=/run/user/1000/pulse/native,target=/run/user/1000/pulse/native,type=bind,consistency=cached",
24-
//"source=/media/media_drive1/obs_files/audio_assets/soundboard_files,target=/soundboard_files,type=bind,consistency=cached",
25-
// "source=/opt/local/renv/cache,target=/renv/cache,type=bind,consistency=cached"
26-
// ],
279
"features": {
28-
//"common": {
29-
// "username": "${localEnv:USER}",
30-
// "uid": "1000",
31-
// "gid": "1000",
32-
// "installZsh": false,
33-
// "installOhMyZsh": false,
34-
// "upgradePackages": true,
35-
// "nonFreePackages": true
36-
//},
3710
"fish": "latest"
3811
},
39-
// Configure environment variables for audio sound server if needed
40-
// You can leave these commented out or delete if you are not linking the contianer to a linux sound system
41-
//"containerEnv": {
42-
// "PULSE_SERVER": "unix:/run/user/1000/pulse/native"
43-
//},
4412

4513
// Set *default* container specific settings.json values on container create.
4614
"settings": {
@@ -84,16 +52,16 @@
8452
"Rubymaniac.vscode-paste-and-indent",
8553
"GrapeCity.gc-excelviewer",
8654
"IBM.output-colorizer",
87-
"Mohamed-El-Fodil-Ihaddaden.shinysnip",
55+
//"Mohamed-El-Fodil-Ihaddaden.shinysnip",
8856
"hediet.vscode-drawio",
89-
"MS-vsliveshare.vsliveshare-pack",
57+
//"MS-vsliveshare.vsliveshare-pack",
9058
"ms-python.python",
9159
"RDebugger.r-debugger",
9260
//"GitHub.copilot",
9361
"eamodio.gitlens",
9462
"GitHub.vscode-pull-request-github",
95-
"quarto.quarto",
96-
"hoovercj.vscode-power-mode"
63+
"quarto.quarto"
64+
//"hoovercj.vscode-power-mode"
9765
]
9866

9967
// Use 'forwardPorts' to make a list of ports inside the container available locally.

.devcontainer/docker-compose.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@ services:
1919
command: sleep infinity
2020
env_file: .env
2121

22-
rstudioquarto:
22+
rstudiodevcontainer:
2323
build:
2424
context: ./rstudio_docker
2525
args:
2626
S6_VERSION: ${S6_VERSION}
2727
RSTUDIO_VERSION: ${RSTUDIO_VERSION}
2828
QUARTO_VERSION: ${QUARTO_VERSION}
29-
container_name: ${CONTAINER_NAME}
3029
volumes:
3130
- ${VOLUME_PATH}:${VOLUME_PATH}
3231
- /home/${USER}/.ssh:/home/${USER}/.ssh
@@ -36,4 +35,4 @@ services:
3635
unless-stopped
3736
ports:
3837
- ${LOCAL_PORT}:8787
39-
env_file: .env
38+
env_file: .env

.devcontainer/library-scripts/r-packages-setup.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
if (Sys.getenv("CODESPACES") == "true" || Sys.getenv("TERM_PROGRAM") == "vscode") {
2+
source(file.path(Sys.getenv(if (.Platform$OS.type == "windows") "USERPROFILE" else "HOME"), ".vscode-R", "init.R"))
3+
options(vsc.rstudioapi = TRUE)
4+
# use the new httpgd plotting device
5+
# options(vsc.plot = FALSE)
6+
# options(device = function(...) {
7+
# httpgd:::hgd()
8+
# .vsc.browser(httpgd::hgd_url(), viewer = "Beside")
9+
# })
10+
Sys.setenv(RENV_PROFILE = "vscode-dev")
11+
}
12+
13+
if (!file.exists("renv/activate.R")) {
14+
renv::init()
15+
} else {
16+
source("renv/activate.R")
17+
}
18+
19+
if (.in_vscode) {
20+
.vscode_pkgs <- c("languageserver", "httpgd", "rstudioapi")
21+
22+
.project <- renv:::renv_project_resolve(NULL)
23+
24+
.lib_packages <- names(unclass(renv:::renv_diagnostics_packages_library(.project))$Packages)
25+
26+
if (!all(.vscode_pkgs %in% .lib_packages)) {
27+
for (pkg in .vscode_pkgs) {
28+
if (!pkg %in% .lib_packages) {
29+
message(paste0("installing package: ", pkg))
30+
renv::install(pkg)
31+
}
32+
}
33+
34+
file.copy(".devcontainer/library-scripts/renv/dependencies.R", "dependencies.R")
35+
36+
renv::snapshot(prompt = FALSE)
37+
}
38+
}
File renamed without changes.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
if (Sys.getenv("CODESPACES") == "true" || Sys.getenv("TERM_PROGRAM") == "vscode") {
2+
source(file.path(Sys.getenv(if (.Platform$OS.type == "windows") "USERPROFILE" else "HOME"), ".vscode-R", "init.R"))
3+
options(vsc.rstudioapi = TRUE)
4+
# use the new httpgd plotting device
5+
# options(vsc.plot = FALSE)
6+
# options(device = function(...) {
7+
# httpgd:::hgd()
8+
# .vsc.browser(httpgd::hgd_url(), viewer = "Beside")
9+
# })
10+
}
11+
12+
if (!file.exists("renv/activate.R")) {
13+
renv::init()
14+
} else {
15+
source("renv/activate.R")
16+
}
17+
18+
if (.in_vscode) {
19+
.vscode_pkgs <- c("languageserver", "httpgd", "rstudioapi")
20+
21+
.project <- renv:::renv_project_resolve(NULL)
22+
23+
.lib_packages <- names(unclass(renv:::renv_diagnostics_packages_library(.project))$Packages)
24+
25+
if (!all(.vscode_pkgs %in% .lib_packages)) {
26+
for (pkg in .vscode_pkgs) {
27+
if (!pkg %in% .lib_packages) {
28+
message(paste0("installing package: ", pkg))
29+
renv::install(pkg)
30+
}
31+
}
32+
33+
file.copy(".devcontainer/library-scripts/renv/dependencies.R", "dependencies.R")
34+
35+
renv::snapshot(prompt = FALSE)
36+
}
37+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
library(languageserver)
2+
library(httpgd)
3+
library(rstudioapi)

0 commit comments

Comments
 (0)