Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] add_dockerfile_with_renv() does not create a Dockerfile #1180

Closed
durraniu opened this issue Sep 14, 2024 · 4 comments
Closed

[BUG] add_dockerfile_with_renv() does not create a Dockerfile #1180

durraniu opened this issue Sep 14, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@durraniu
Copy link

Describe the bug
Running add_dockerfile_with_renv() does not create a Dockerfile.

To Reproduce
Steps to reproduce the behavior:

  1. Create golem golem::create_golem("<package name>")
  2. Complete the first two files in dev
  3. After no errors in devtools::check(), run golem::add_dockerfile_with_renv(). It produces a README with commands for the terminal but no Dockerfile is created. I am using version 0.5.1 of golem.

Expected behavior
golem::add_dockerfile_with_renv() is expected to create a Dockerfile.

session info

─ Session info ──────────────────────────────────────────────────────────
 setting  value
 version  R version 4.3.2 (2023-10-31 ucrt)
 os       Windows 10 x64 (build 19045)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  English_United States.utf8
 ctype    English_United States.utf8
 tz       America/Toronto
 date     2024-09-13
 rstudio  2024.04.2+764 Chocolate Cosmos (desktop)
 pandoc   3.1.11 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)

─ Packages ──────────────────────────────────────────────────────────────
 ! package      * version    date (UTC) lib source
   attachment     0.4.0      2023-05-31 [1] CRAN (R 4.3.1)
   attempt        0.3.1      2020-05-03 [1] CRAN (R 4.3.1)
   base64enc      0.1-3      2015-07-28 [1] CRAN (R 4.3.0)
   brio           1.1.3      2021-11-30 [1] CRAN (R 4.3.1)
   bsicons        0.1.2      2023-11-04 [1] CRAN (R 4.3.3)
   bslib          0.8.0      2024-07-29 [1] CRAN (R 4.3.3)
   cachem         1.1.0      2024-05-16 [1] CRAN (R 4.3.3)
   callr          3.7.3      2022-11-02 [1] CRAN (R 4.3.1)
   cli            3.6.1      2023-03-23 [1] CRAN (R 4.3.1)
   config         0.3.2      2023-08-30 [1] CRAN (R 4.3.1)
   crayon         1.5.2      2022-09-29 [1] CRAN (R 4.3.1)
   desc           1.4.2      2022-09-08 [1] CRAN (R 4.3.1)
   devtools     * 2.4.5      2022-10-11 [1] CRAN (R 4.3.1)
   digest         0.6.33     2023-07-07 [1] CRAN (R 4.3.1)
   dockerfiler    0.2.1      2023-01-18 [1] CRAN (R 4.3.1)
   ellipsis       0.3.2      2021-04-29 [1] CRAN (R 4.3.1)
   evaluate       0.23       2023-11-01 [1] CRAN (R 4.3.2)
   fastmap        1.2.0      2024-05-15 [1] CRAN (R 4.3.3)
   fs             1.6.3      2023-07-20 [1] CRAN (R 4.3.1)
   glue           1.6.2      2022-02-24 [1] CRAN (R 4.3.1)
   golem          0.5.1      2024-08-27 [1] CRAN (R 4.3.3)
   htmltools      0.5.8.1    2024-04-04 [1] CRAN (R 4.3.3)
   htmlwidgets    1.6.3      2023-11-22 [1] CRAN (R 4.3.2)
   httpuv         1.6.14     2024-01-26 [1] CRAN (R 4.3.3)
   httr           1.4.6      2023-05-08 [1] CRAN (R 4.3.1)
   httr2          1.0.2      2024-07-16 [1] CRAN (R 4.3.3)
   jquerylib      0.1.4      2021-04-26 [1] CRAN (R 4.3.1)
   jsonlite       1.8.7      2023-06-29 [1] CRAN (R 4.3.1)
   knitr          1.45       2023-10-30 [1] CRAN (R 4.3.2)
   later          1.3.1      2023-05-02 [1] CRAN (R 4.3.1)
   lifecycle      1.0.4      2023-11-07 [1] CRAN (R 4.3.2)
   magrittr       2.0.3      2022-03-30 [1] CRAN (R 4.3.1)
   memoise        2.0.1      2021-11-26 [1] CRAN (R 4.3.1)
   mime           0.12       2021-09-28 [1] CRAN (R 4.3.0)
   miniUI         0.1.1.1    2018-05-18 [1] CRAN (R 4.3.1)
   pak            0.6.0      2023-08-29 [1] CRAN (R 4.3.1)
   pkgbuild       1.4.2      2023-06-26 [1] CRAN (R 4.3.1)
   pkgload        1.3.2.1    2023-07-08 [1] CRAN (R 4.3.1)
   prettyunits    1.2.0      2023-09-24 [1] CRAN (R 4.3.1)
   processx       3.8.2      2023-06-30 [1] CRAN (R 4.3.1)
   profvis        0.3.8      2023-05-02 [1] CRAN (R 4.3.1)
   promises       1.2.1      2023-08-10 [1] CRAN (R 4.3.1)
   ps             1.7.5      2023-04-18 [1] CRAN (R 4.3.1)
   purrr          1.0.2      2023-08-10 [1] CRAN (R 4.3.1)
   quarto         1.4.4      2024-07-20 [1] CRAN (R 4.3.3)
   R6             2.5.1      2021-08-19 [1] CRAN (R 4.3.1)
   rappdirs       0.3.3      2021-01-31 [1] CRAN (R 4.3.1)
   Rcpp           1.0.11     2023-07-06 [1] CRAN (R 4.3.1)
   remotes        2.4.2.1    2023-07-18 [1] CRAN (R 4.3.1)
   renv           1.0.3      2023-09-19 [1] CRAN (R 4.3.1)
   rlang          1.1.2      2023-11-04 [1] CRAN (R 4.3.2)
   rmarkdown      2.25       2023-09-18 [1] CRAN (R 4.3.2)
   roxygen2       7.2.3      2022-12-08 [1] CRAN (R 4.3.1)
   rprojroot      2.0.4      2023-11-05 [1] CRAN (R 4.3.2)
   rstudioapi     0.15.0     2023-07-07 [1] CRAN (R 4.3.1)
   rvest          1.0.3      2022-08-19 [1] CRAN (R 4.3.1)
   sass           0.4.9      2024-03-15 [1] CRAN (R 4.3.3)
   sessioninfo    1.2.2      2021-12-06 [1] CRAN (R 4.3.1)
   shiny          1.9.1      2024-08-01 [1] CRAN (R 4.3.3)
   shinyalert     3.1.0      2024-04-27 [1] CRAN (R 4.3.3)
 R storytimegcp * 0.0.0.9000 <NA>       [?] <NA>
   stringi        1.8.2      2023-11-23 [1] CRAN (R 4.3.2)
   stringr        1.5.1      2023-11-14 [1] CRAN (R 4.3.2)
   testthat       3.1.10     2023-07-06 [1] CRAN (R 4.3.1)
   urlchecker     1.0.1      2021-11-30 [1] CRAN (R 4.3.1)
   usethis      * 2.2.2      2023-07-06 [1] CRAN (R 4.3.1)
   vctrs          0.6.4      2023-10-12 [1] CRAN (R 4.3.2)
   withr          3.0.0      2024-01-16 [1] CRAN (R 4.3.2)
   xfun           0.41       2023-11-01 [1] CRAN (R 4.3.2)
   xml2           1.3.5      2023-07-06 [1] CRAN (R 4.3.1)
   xtable         1.8-4      2019-04-21 [1] CRAN (R 4.3.1)
   yaml           2.3.7      2023-01-23 [1] CRAN (R 4.3.0)

 [1] C:/Users/umair/AppData/Local/R/win-library/4.3
 [2] C:/Program Files/R/R-4.3.2/library

 R ── Package was removed from disk.

─────────────────────────────────────────────────────────────────────────

Additional context
golem::add_dockerfile() creates a Dockerfile.

@durraniu durraniu added the bug Something isn't working label Sep 14, 2024
@VincentGuyader
Copy link
Member

VincentGuyader commented Sep 14, 2024

Hi,

thanks for your issue.
I’ve been unable to reproduce the reported issue. In simple cases, creating a golem and running golem::add_dockerfile_with_renv() consistently generates a folder with everything needed, including the Dockerfile.

I also tried stepping through the contents of the dev files to pinpoint where the problem might occur, but without success, as everything continues to work as expected.

I have verified that I am using the same package versions mentioned in the ticket, specifically for dockerfiler, renv, and golem.

Could you please try running just these two commands:

golem::create_golem("golemname")
golem::add_dockerfile_with_renv()

And Let me know if the issue occurs with this golem project as well.

Additionally, if possible, I would appreciate receiving the contents of an RStudio project that generates the problem (ie , in wich golem::add_dockerfile_with_renv() doesnt work well). This would help me better understand the issue.

Regards

@durraniu
Copy link
Author

Thanks for looking into this issue. I have run the following commands:

golem::create_golem("golemname")
golem::add_dockerfile_with_renv()

That did not produce a dockerfile. These are all the files after running the commands above:
image

This is what I see in the console:

> golem::add_dockerfile_with_renv()
You set `document = TRUE` and you did not pass your own renv.lock file,
as a consequence {golem} will use `attachment::att_amend_desc()` to update your 
DESCRIPTION file before creating the renv.lock file

you can set `document = FALSE` to use your actual DESCRIPTION file,
or pass you own renv.lock to use, using the `lockfile` parameter

In any case be sure to have no Error or Warning at `devtools::check()`
Saving attachment parameters to yaml config file
Updating golemname documentation
Setting `RoxygenNote` to "7.2.3"
ℹ Loading golemname
Writing NAMESPACE
Writing NAMESPACE
ℹ Loading golemname
All required packages are installed
✔ create renv.lock at C:/Users/umair/AppData/Local/Temp/RtmpcR4uyN/deploy/renv.lock.prod
The following package(s) will be updated in the lockfile:

# CRAN ------------------------------------------------------
- attempt       [* -> 0.3.1]
- base64enc     [* -> 0.1-3]
- bslib         [* -> 0.8.0]
- cachem        [* -> 1.1.0]
- cli           [* -> 3.6.1]
- commonmark    [* -> 1.9.1]
- config        [* -> 0.3.2]
- crayon        [* -> 1.5.3]
- digest        [* -> 0.6.33]
- fastmap       [* -> 1.2.0]
- fontawesome   [* -> 0.5.2]
- fs            [* -> 1.6.3]
- glue          [* -> 1.6.2]
- htmltools     [* -> 0.5.8.1]
- httpuv        [* -> 1.6.14]
- jquerylib     [* -> 0.1.4]
- jsonlite      [* -> 1.8.8]
- later         [* -> 1.3.1]
- lifecycle     [* -> 1.0.4]
- magrittr      [* -> 2.0.3]
- memoise       [* -> 2.0.1]
- mime          [* -> 0.12]
- promises      [* -> 1.2.1]
- R6            [* -> 2.5.1]
- rappdirs      [* -> 0.3.3]
- Rcpp          [* -> 1.0.11]
- remotes       [* -> 2.4.2.1]
- rlang         [* -> 1.1.2]
- sass          [* -> 0.4.9]
- shiny         [* -> 1.9.1]
- sourcetools   [* -> 0.1.7-1]
- withr         [* -> 3.0.1]
- xtable        [* -> 1.8-4]
- yaml          [* -> 2.3.10]

# GitHub ----------------------------------------------------
- golem         [* -> Thinkr-open/golem@dev]

The version of R recorded in the lockfile will be updated:
- R             [* -> 4.3.2]

- Lockfile written to "C:/Users/umair/AppData/Local/Temp/RtmpcR4uyN/deploy/renv.lock.prod".
ℹ Please wait while we compute system requirements...
Fetching system dependencies for 35 package records.
`pak::pkg_system_requirements()` is deprecated since pak 0.6.0.
Please use `pak::pkg_sysreqs()` instead.
✔ Done
── R CMD build ────────────────────────────────────────────────────────
✔  checking for file 'C:\Users\umair\Documents\golemname/DESCRIPTION' ...
─  preparing 'golemname':
✔  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
   Omitted 'LazyData' from DESCRIPTION
─  building 'golemname_0.0.0.9000.tar.gz'
   
✔  C:/Users/umair/AppData/Local/Temp/RtmpcR4uyN/deploy/golemname_0.0.0.9000.tar.gz created.

The only thing that happened was this README file that opened:

docker build -f Dockerfile_base --progress=plain -t golemname_base .
docker build -f Dockerfile --progress=plain -t golemname:latest .
docker run -p 80:80 golemname:latest
# then go to 127.0.0.1:80

Here is the GitHub repo for this project: https://github.com/durraniu/golemname

Session Info

> devtools::session_info()
─ Session info ───────────────────────────────────────────
 setting  value
 version  R version 4.3.2 (2023-10-31 ucrt)
 os       Windows 10 x64 (build 19045)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  English_United States.utf8
 ctype    English_United States.utf8
 tz       America/Toronto
 date     2024-09-14
 rstudio  2024.04.2+764 Chocolate Cosmos (desktop)
 pandoc   NA

─ Packages ───────────────────────────────────────────────
 ! package     * version    date (UTC) lib source
   attachment    0.4.0      2023-05-31 [1] CRAN (R 4.3.1)
   attempt       0.3.1      2020-05-03 [1] CRAN (R 4.3.1)
   brio          1.1.3      2021-11-30 [1] CRAN (R 4.3.1)
   cachem        1.1.0      2024-05-16 [1] CRAN (R 4.3.3)
   callr         3.7.3      2022-11-02 [1] CRAN (R 4.3.1)
   cli           3.6.1      2023-03-23 [1] CRAN (R 4.3.1)
   config        0.3.2      2023-08-30 [1] CRAN (R 4.3.1)
   crayon        1.5.3      2024-06-20 [1] CRAN (R 4.3.3)
   desc          1.4.2      2022-09-08 [1] CRAN (R 4.3.1)
   devtools    * 2.4.5      2022-10-11 [1] CRAN (R 4.3.1)
   digest        0.6.33     2023-07-07 [1] CRAN (R 4.3.1)
   dockerfiler   0.2.1      2023-01-18 [1] CRAN (R 4.3.1)
   ellipsis      0.3.2      2021-04-29 [1] CRAN (R 4.3.1)
   fastmap       1.2.0      2024-05-15 [1] CRAN (R 4.3.3)
   fs            1.6.3      2023-07-20 [1] CRAN (R 4.3.1)
   glue          1.6.2      2022-02-24 [1] CRAN (R 4.3.1)
   golem         0.5.1.9004 2024-09-14 [1] Github (Thinkr-open/golem@4762236)
 R golemname   * 0.0.0.9000 <NA>       [?] <NA>
   htmltools     0.5.8.1    2024-04-04 [1] CRAN (R 4.3.3)
   htmlwidgets   1.6.3      2023-11-22 [1] CRAN (R 4.3.2)
   httpuv        1.6.14     2024-01-26 [1] CRAN (R 4.3.3)
   jsonlite      1.8.8      2023-12-04 [1] CRAN (R 4.3.3)
   knitr         1.45       2023-10-30 [1] CRAN (R 4.3.2)
   later         1.3.1      2023-05-02 [1] CRAN (R 4.3.1)
   lifecycle     1.0.4      2023-11-07 [1] CRAN (R 4.3.2)
   magrittr      2.0.3      2022-03-30 [1] CRAN (R 4.3.1)
   memoise       2.0.1      2021-11-26 [1] CRAN (R 4.3.1)
   mime          0.12       2021-09-28 [1] CRAN (R 4.3.0)
   miniUI        0.1.1.1    2018-05-18 [1] CRAN (R 4.3.1)
   pak           0.6.0      2023-08-29 [1] CRAN (R 4.3.1)
   pkgbuild      1.4.2      2023-06-26 [1] CRAN (R 4.3.1)
   pkgload       1.3.2.1    2023-07-08 [1] CRAN (R 4.3.1)
   prettyunits   1.2.0      2023-09-24 [1] CRAN (R 4.3.1)
   processx      3.8.2      2023-06-30 [1] CRAN (R 4.3.1)
   profvis       0.3.8      2023-05-02 [1] CRAN (R 4.3.1)
   promises      1.2.1      2023-08-10 [1] CRAN (R 4.3.1)
   ps            1.7.5      2023-04-18 [1] CRAN (R 4.3.1)
   purrr         1.0.2      2023-08-10 [1] CRAN (R 4.3.1)
   R6            2.5.1      2021-08-19 [1] CRAN (R 4.3.1)
   Rcpp          1.0.11     2023-07-06 [1] CRAN (R 4.3.1)
   remotes       2.4.2.1    2023-07-18 [1] CRAN (R 4.3.1)
   renv          1.0.3      2023-09-19 [1] CRAN (R 4.3.1)
   rlang         1.1.2      2023-11-04 [1] CRAN (R 4.3.2)
   roxygen2      7.2.3      2022-12-08 [1] CRAN (R 4.3.1)
   rprojroot     2.0.4      2023-11-05 [1] CRAN (R 4.3.2)
   rstudioapi    0.15.0     2023-07-07 [1] CRAN (R 4.3.1)
   sessioninfo   1.2.2      2021-12-06 [1] CRAN (R 4.3.1)
   shiny         1.9.1      2024-08-01 [1] CRAN (R 4.3.3)
   stringi       1.8.2      2023-11-23 [1] CRAN (R 4.3.2)
   stringr       1.5.1      2023-11-14 [1] CRAN (R 4.3.2)
   testthat      3.1.10     2023-07-06 [1] CRAN (R 4.3.1)
   urlchecker    1.0.1      2021-11-30 [1] CRAN (R 4.3.1)
   usethis     * 2.2.2      2023-07-06 [1] CRAN (R 4.3.1)
   vctrs         0.6.4      2023-10-12 [1] CRAN (R 4.3.2)
   withr         3.0.1      2024-07-31 [1] CRAN (R 4.3.3)
   xfun          0.41       2023-11-01 [1] CRAN (R 4.3.2)
   xml2          1.3.5      2023-07-06 [1] CRAN (R 4.3.1)
   xtable        1.8-4      2019-04-21 [1] CRAN (R 4.3.1)
   yaml          2.3.10     2024-07-26 [1] CRAN (R 4.3.3)

 [1] C:/Users/umair/AppData/Local/R/win-library/4.3
 [2] C:/Program Files/R/R-4.3.2/library

 R ── Package was removed from disk.

──────────────────────────────────────────────────────────

@VincentGuyader
Copy link
Member

VincentGuyader commented Sep 14, 2024

you have to go in :

C:/Users/umair/AppData/Local/Temp/RtmpcR4uyN/deploy/

or, specify an output using golem::add_dockerfile_with_renv(output_dir = "deploy")

I will add something more explicit in documentation and console output about this.

@durraniu
Copy link
Author

golem::add_dockerfile_with_renv(output_dir = "deploy") worked for me, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants