【问题标题】:Docker build is slow on JenkinsJenkins 上的 Docker 构建速度很慢
【发布时间】:2021-09-01 03:34:49
【问题描述】:

我正在尝试通过 Jenkins 管道构建 docker 映像,这需要很长时间(4-5 小时,大多数时候都失败了)。当我从同一台 Jenkins 机器的命令行构建映像时,大约需要 20 分钟。这些是作业停止的 Dockerfile 命令 -

ARG PKGS="askpass, assertthat, backports, base64enc, BH, bit, bit64, blob, brew, brio, broom, callr, caret, cellranger, chron, cli, clipr, colorspace, commonmark, config, covr, cpp11, crayon, credentials, crosstalk, curl, data.table, DBI, dbplyr, desc, devtools, diffobj, digest, dplyr, DT, ellipsis, evaluate, fansi, farver, fastmap, forcats, foreach, forge, fs, future, generics, gert, ggplot2, gh, gitcreds, glmnet, globals, glue, gower, gridExtra, gsubfn, gtable, haven, highr, hms, htmlwidgets, httpuv, httr, ini, ipred, isoband, iterators, jsonlite, knitr, labeling, later, lava, lazyeval, lifecycle, listenv, lubridate, magrittr, markdown, memoise, mime, ModelMetrics, modelr, munsell, numDeriv, openssl, parallelly, pillar, pkgbuild, pkgconfig, pkgload, plogr, plyr, praise, prettyunits, pROC, processx, prodlim, progress, promises, proto, ps, purrr, r2d3, R6, randomForest, rappdirs, rcmdcheck, RColorBrewer, Rcpp, readxl"
# Install through pak and other cleanup tasks
RUN Rscript -e 'install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")' \
    && echo "$PKGS" \
    | Rscript -e 'pak::pkg_install(strsplit(readLines("stdin"), ", ?")[[1L]], ask = FALSE)' \
    && Rscript -e 'pak::cache_clean()'

ARG PKGS="recipes, rematch, rematch2, remotes, reprex, reshape2, rex, rlang, rmarkdown, roxygen2, rprojroot, RSQLite, rstudioapi, rversions, rvest, scales, selectr, sessioninfo, shape, shiny, sourcetools, sparklyr, SparkR, sqldf, SQUAREM, stringi, stringr, sys, testthat, tibble, tidyr, tidyselect, tidyverse, timeDate, tinytex, usethis, utf8, uuid, vctrs, viridisLite, waldo, whisker, withr, xfun, xml2, xopen, xtable, yaml, zip"
# Install through pak and other cleanup tasks
RUN Rscript -e 'install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")' \
    && echo "$PKGS" \
    | Rscript -e 'pak::pkg_install(strsplit(readLines("stdin"), ", ?")[[1L]], ask = FALSE)' \
    && Rscript -e 'pak::cache_clean()'

我怀疑这与 Jenkins 有关,因为从命令行可以正常构建。 Jenkins 中是否有一些设置会减慢这些软件包的下载和安装速度?谢谢。

【问题讨论】:

  • jenkins 是否安装在同一台机器上?
  • @AntonioPetricca 是的,这是我尝试从命令行构建的同一台机器。

标签: r docker jenkins dockerfile rscript


【解决方案1】:

想通了,需要用前面的 \ 转义 $ 字符,这样它就不会被评估。基本上用"\\$PKGS"替换"$PKGS"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-05-14
    • 1970-01-01
    • 2021-07-21
    • 2021-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多