dockerfiler
dockerfiler copied to clipboard
add_dockerfile_with_renv() generates unusual code to install Chrome's system dependence
My Shiny app makes use of the {chromote} package, which relies on Google Chrome. When I run add_dockerfile_with_renv(), I get the following (not complete) code for the Dockerfile_base:
...
RUN apt-get update -y && apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev libicu-dev libnode-dev make pandoc zlib1g-dev [ $(which google-chrome) ] || gnupg curl [ $(which google-chrome) ] || curl -fsSL -o /tmp/google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb [ $(which google-chrome) ] || DEBIAN_FRONTEND='noninteractive' /tmp/google-chrome.deb git libfontconfig1-dev libfreetype6-dev libcairo2-dev libgit2-dev && rm -rf /var/lib/apt/lists/*
...
Upon attempting to build the container based on this dockerfile, I get the following error:
E: Unable to locate package [
E: Couldn't find any package by glob '['
E: Regex compilation error - Invalid regular expression
E: Couldn't find any package by regex '['
E: Unable to locate package ]
E: Couldn't find any package by glob ']'
/bin/sh: 1: gnupg: not found
curl: (3) bad range specification in URL position 2:
[
^
/bin/sh: 1: /tmp/google-chrome.deb: Permission denied
This is apparently caused by the three bits of the Dockerfile_base with [ $(which google-chrome) ]. Everything runs smoothly when I take these bits out, but at the end of the building process, google-chrome is unfortunately not installed as checked by which google-chrome in the command line.
(Note: I've transferred to this repo as {dockerfiler} is the one in charge of Dockerfile creation)
Thanks for reporting, we'll have a look into that
I'm getting a similar set of errors trying to build with these new system dependencies
Dockerfile
FROM rocker/r-ver:4.2.1@sha256:3e3f21d75482c5c66e122188ae88ad5c89ca24f5202dd07f69c623b3c8af7e80
RUN apt-get update -y && apt-get install -y libicu-dev pandoc make libmysqlclient-dev libssl-dev libcurl4-openssl-dev zlib1g-dev [ $(which google-chrome) ] || gnupg curl [ $(which google-chrome) ] || curl -fsSL -o /tmp/google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb [ $(which google-chrome) ] || DEBIAN_FRONTEND='noninteractive' /tmp/google-chrome.deb git libfreetype6-dev libfribidi-dev libharfbuzz-dev libxml2-dev libfontconfig1-dev libgit2-dev libjpeg-dev libpng-dev libtiff-dev && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/local/lib/R/etc/ /usr/lib/R/etc/
RUN echo "options(renv.config.pak.enabled = TRUE, repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl', Ncpus = 4)" | tee /usr/local/lib/R/etc/Rprofile.site | tee /usr/lib/R/etc/Rprofile.site
RUN R -e 'install.packages(c("renv","remotes"))'
RUN mkdir -p /usr/local/lib/R/etc/ /usr/lib/R/etc/
RUN echo "options(renv.config.pak.enabled = TRUE, repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl', Ncpus = 4)" | tee /usr/local/lib/R/etc/Rprofile.site | tee /usr/lib/R/etc/Rprofile.site
RUN R -e 'install.packages(c("renv","remotes"))'
COPY renv.lock renv.lock
COPY .Renviron /.Renviron
COPY .Rprofile /.Rprofile
RUN R -e 'renv::restore()'
COPY dmdu_*.tar.gz /app.tar.gz
RUN R -e 'remotes::install_local("/app.tar.gz",upgrade="never")'
RUN rm /app.tar.gz
EXPOSE 80
CMD R -e "options('shiny.port'=80,shiny.host='0.0.0.0');dmdu::run_app()"
Error Message
#5 [ 2/10] RUN apt-get update -y && apt-get install -y libicu-dev pandoc make libmysqlclient-dev libssl-dev libcurl4-openssl-dev zlib1g-dev [ $(which google-chrome) ] || gnupg curl [ $(which google-chrome) ] || curl -fsSL -o /tmp/google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb [ $(which google-chrome) ] || DEBIAN_FRONTEND='noninteractive' /tmp/google-chrome.deb git libfreetype6-dev libfribidi-dev libharfbuzz-dev libxml2-dev libfontconfig1-dev libgit2-dev libjpeg-dev libpng-dev libtiff-dev && rm -rf /var/lib/apt/lists/*
#5 sha256:b9791ef9b811b86ebb23f3d335463d7b13b9935e7233005e88501094fb91d6a5
#5 0.845 Get:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease [265 kB]
#5 1.466 Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [114 kB]
#5 1.617 Get:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease [108 kB]
#5 1.768 Get:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [114 kB]
#5 1.925 Get:5 http://ports.ubuntu.com/ubuntu-ports focal/universe arm64 Packages [11.1 MB]
#5 5.271 Get:6 http://ports.ubuntu.com/ubuntu-ports focal/multiverse arm64 Packages [139 kB]
#5 5.291 Get:7 http://ports.ubuntu.com/ubuntu-ports focal/restricted arm64 Packages [1,317 B]
#5 5.291 Get:8 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 Packages [1,234 kB]
#5 5.745 Get:9 http://ports.ubuntu.com/ubuntu-ports focal-updates/restricted arm64 Packages [5,240 B]
#5 5.745 Get:10 http://ports.ubuntu.com/ubuntu-ports focal-updates/multiverse arm64 Packages [9,068 B]
#5 5.745 Get:11 http://ports.ubuntu.com/ubuntu-ports focal-updates/main arm64 Packages [2,152 kB]
#5 6.545 Get:12 http://ports.ubuntu.com/ubuntu-ports focal-updates/universe arm64 Packages [1,205 kB]
#5 7.719 Get:13 http://ports.ubuntu.com/ubuntu-ports focal-backports/main arm64 Packages [54.8 kB]
#5 7.737 Get:14 http://ports.ubuntu.com/ubuntu-ports focal-backports/universe arm64 Packages [27.8 kB]
#5 7.743 Get:15 http://ports.ubuntu.com/ubuntu-ports focal-security/restricted arm64 Packages [5,003 B]
#5 7.745 Get:16 http://ports.ubuntu.com/ubuntu-ports focal-security/main arm64 Packages [1,766 kB]
#5 8.266 Get:17 http://ports.ubuntu.com/ubuntu-ports focal-security/multiverse arm64 Packages [3,252 B]
#5 8.267 Get:18 http://ports.ubuntu.com/ubuntu-ports focal-security/universe arm64 Packages [912 kB]
#5 8.576 Fetched 19.2 MB in 8s (2,309 kB/s)
#5 8.576 Reading package lists...
#5 9.014 Reading package lists...
#5 9.396 Building dependency tree...
#5 9.470 Reading state information...
#5 9.513 E: Unable to locate package [
#5 9.513 E: Couldn't find any package by glob '['
#5 9.513 E: Regex compilation error - Invalid regular expression
#5 9.513 E: Couldn't find any package by regex '['
#5 9.513 E: Unable to locate package ]
#5 9.513 E: Couldn't find any package by glob ']'
#5 9.515 /bin/sh: 1: gnupg: not found
#5 9.515 /bin/sh: 1: curl: not found
#5 9.516 /bin/sh: 1: /tmp/google-chrome.deb: not found
#5 ERROR: executor failed running [/bin/sh -c apt-get update -y && apt-get install -y libicu-dev pandoc make libmysqlclient-dev libssl-dev libcurl4-openssl-dev zlib1g-dev [ $(which google-chrome) ] || gnupg curl [ $(which google-chrome) ] || curl -fsSL -o /tmp/google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb [ $(which google-chrome) ] || DEBIAN_FRONTEND='noninteractive' /tmp/google-chrome.deb git libfreetype6-dev libfribidi-dev libharfbuzz-dev libxml2-dev libfontconfig1-dev libgit2-dev libjpeg-dev libpng-dev libtiff-dev && rm -rf /var/lib/apt/lists/*]: exit code: 127
------
> [ 2/10] RUN apt-get update -y && apt-get install -y libicu-dev pandoc make libmysqlclient-dev libssl-dev libcurl4-openssl-dev zlib1g-dev [ $(which google-chrome) ] || gnupg curl [ $(which google-chrome) ] || curl -fsSL -o /tmp/google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb [ $(which google-chrome) ] || DEBIAN_FRONTEND='noninteractive' /tmp/google-chrome.deb git libfreetype6-dev libfribidi-dev libharfbuzz-dev libxml2-dev libfontconfig1-dev libgit2-dev libjpeg-dev libpng-dev libtiff-dev && rm -rf /var/lib/apt/lists/*:
------
executor failed running [/bin/sh -c apt-get update -y && apt-get install -y libicu-dev pandoc make libmysqlclient-dev libssl-dev libcurl4-openssl-dev zlib1g-dev [ $(which google-chrome) ] || gnupg curl [ $(which google-chrome) ] || curl -fsSL -o /tmp/google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb [ $(which google-chrome) ] || DEBIAN_FRONTEND='noninteractive' /tmp/google-chrome.deb git libfreetype6-dev libfribidi-dev libharfbuzz-dev libxml2-dev libfontconfig1-dev libgit2-dev libjpeg-dev libpng-dev libtiff-dev && rm -rf /var/lib/apt/lists/*]: exit code: 127
SessionInfo
R version 4.2.1 (2022-06-23)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.2.1
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices datasets utils methods base
loaded via a namespace (and not attached):
[1] xfun_0.36 remotes_2.4.2 purrr_1.0.1 pak_0.3.0
[5] vctrs_0.5.2 miniUI_0.1.1.1 htmltools_0.5.4 usethis_2.1.6
[9] yaml_2.3.5 utf8_1.2.2 rlang_1.0.6 pkgbuild_1.3.1
[13] urlchecker_1.0.1 pillar_1.8.1 later_1.3.0 withr_2.5.0
[17] glue_1.6.2 sessioninfo_1.2.2 lifecycle_1.0.3 plyr_1.8.7
[21] stringr_1.5.0 UU_1.16.0 devtools_2.4.5 htmlwidgets_1.5.4
[25] memoise_2.0.1 knitr_1.40 callr_3.7.2 fastmap_1.1.0
[29] golem_0.3.4 httpuv_1.6.8 ps_1.7.1 fansi_1.0.3
[33] attachment_0.2.5 Rcpp_1.0.9 xtable_1.8-4 renv_0.16.0
[37] promises_1.2.0.1 cachem_1.0.6 desc_1.4.2 pkgload_1.3.0
[41] jsonlite_1.8.4 config_0.3.1 mime_0.12 fs_1.5.2
[45] digest_0.6.31 stringi_1.7.8 processx_3.7.0 shiny_1.7.4
[49] rprojroot_2.0.3 cli_3.6.0 tools_4.2.1 dockerfiler_0.2.1
[53] magrittr_2.0.3 tibble_3.1.8 profvis_0.3.7 crayon_1.5.2
[57] pkgconfig_2.0.3 ellipsis_0.3.2 xml2_1.3.3 prettyunits_1.1.1
[61] attempt_0.3.1 roxygen2_7.2.1 rstudioapi_0.14 R6_2.5.1
[65] compiler_4.2.1
Any ideas on how to get around this @ColinFay ?
Update 2023-02-28 17:18:11 EST: Fortunately had the old Dockerfile saved, copy pasted the system dependencies on the second line from there and now it's working again:
RUN apt-get update -y && apt-get install -y libmysqlclient-dev libcurl4-openssl-dev libssl-dev make zlib1g-dev git libicu-dev libfreetype6-dev libfribidi-dev libharfbuzz-dev libxml2-dev libfontconfig1-dev libjpeg-dev libpng-dev libtiff-dev pandoc libgit2-dev && rm -rf /var/lib/apt/lists/*
Seems like the addition of the new system dependencies in new versions of dockerfiler may be problematic on some machines?
reprex :
remotes::install_github("thinkr-open/golem@dev")
golem::create_golem(path = ".",overwrite = TRUE)
usethis::use_package("chromote")
golem::add_dockerfile_with_renv(output_dir = "deploy",document = FALSE)
easy way to deal with it :
golem::add_dockerfile_with_renv(output_dir = "deploy",document = FALSE, expand = TRUE)
use expand = TRUE instead of expand = FALSE
wiil be fixed by : https://github.com/ThinkR-open/dockerfiler/pull/54
Awesome thank you @VincentGuyader