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

Build failing for cr_deploy_plumber() #32

Closed
AlunHewinson opened this issue Jan 5, 2020 · 4 comments
Closed

Build failing for cr_deploy_plumber() #32

AlunHewinson opened this issue Jan 5, 2020 · 4 comments

Comments

@AlunHewinson
Copy link

AlunHewinson commented Jan 5, 2020

Build is failing on cr <- cr_deploy_plumber("Google/Cloud_Runner/api01"). Here's the details :)

Last bit of build log

Step #0: Get:1 http://deb.debian.org/debian testing InRelease [113 kB]
Step #0: Get:2 http://cdn-fastly.deb.debian.org/debian sid InRelease [142 kB]
Step #0: Get:3 http://cdn-fastly.deb.debian.org/debian sid/main amd64 Packages.diff/Index [27.9 kB]
Step #0: Ign:3 http://cdn-fastly.deb.debian.org/debian sid/main amd64 Packages.diff/Index
Step #0: Get:4 http://cdn-fastly.deb.debian.org/debian sid/main amd64 Packages [8,251 kB]
Step #0: Reading package lists...
Step #0: E: Repository 'http://deb.debian.org/debian testing InRelease' changed its 'Codename' value from 'buster' to 'bullseye'
Step #0: The command '/bin/sh -c export DEBIAN_FRONTEND=noninteractive; apt-get -y update && apt-get install -y make' returned a non-zero code: 100
Finished Step #0
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: exit status 100
Step #0:

R log

2020-01-05 19:20:21> Uploading Google/Cloud_Runner/api01 folder for Cloud Run
2020-01-05 19:20:21> Building Google/Cloud_Runner/api01 folder for Docker image: gcr.io/twentytwenty-264010/api01
2020-01-05 19:20:21> Configuring Dockerfile
2020-01-05 19:20:21> Dockerfile found in Google/Cloud_Runner/api01
2020-01-05 19:20:21> Image to be built: gcr.io/twentytwenty-264010/api01:$BUILD_ID
2020-01-05 19:20:21> #Deploy docker build for image: 
 gcr.io/twentytwenty-264010/api01:$BUILD_ID
2020-01-05 19:20:21> #Upload  Google/Cloud_Runner/api01  to  gs://2020-runner/api01
2020-01-05 19:20:21> Copying files from Google/Cloud_Runner/api01 to /deploy
2020-01-05 19:20:21> Compressing files from /deploy to api01.tar.gz
2020-01-05 19:20:21> Uploading api01.tar.gz to 2020-runner/api01
2020-01-05 19:20:21 -- File size detected as 674 bytes
2020-01-05 19:20:24> Cloud Build started - logs: 
https://console.cloud.google.com/gcr/builds/7b853871-254a-486d-9eb6-1026b9ac0f1c?project=897665581353
2020-01-05 19:20:25> 
#> Created Cloud Build, online logs:
 https://console.cloud.google.com/gcr/builds/7b853871-254a-486d-9eb6-1026b9ac0f1c?project=897665581353
Waiting for build to finish:
 |==========| Build finished
2020-01-05 19:21:16> Build finished with status: FAILURE
2020-01-05 19:21:16> gcr.io/twentytwenty-264010/api01:$BUILD_ID
2020-01-05 19:21:16> Error building Dockerfile

./Google/Cloud_Runner/api01/Dockerfile:

FROM trestletech/plumber
RUN export DEBIAN_FRONTEND=noninteractive; apt-get -y update \
  && apt-get install -y make
RUN ["install2.r", "crayon", "httpuv", "jsonlite", "later", "magrittr", "plumber", "promises", "R6", "Rcpp", "rstudioapi", "stringi"]
COPY ["./", "./"]
ENTRYPOINT ["R", "-e", "pr <- plumber::plumb(commandArgs()[4]); pr$run(host='0.0.0.0', port=as.numeric(Sys.getenv('PORT')))"]
CMD ["api.R"]

Environment

getwd()

C:/Users/alunh/OneDrive/Documents/Repos/learning

sessionInfo()

R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] plumber_0.4.6              googleCloudRunner_0.0.9005 leaflet_2.0.3             
 [4] sp_1.3-2                   forcats_0.4.0              stringr_1.4.0             
 [7] dplyr_0.8.3                purrr_0.3.3                readr_1.3.1               
[10] tidyr_1.0.0                tibble_2.1.3               ggplot2_3.2.1             
[13] tidyverse_1.3.0            magrittr_1.5               RGoogleFit_0.3.1          
[16] httr_1.4.1                 bit64_0.9-7                bit_1.1-14                
[19] jsonlite_1.6               RCurl_1.95-4.12            bitops_1.0-6              

loaded via a namespace (and not attached):
 [1] nlme_3.1-137                   fs_1.3.1                       lubridate_1.7.4               
 [4] rprojroot_1.3-2                googleAuthR_1.1.1              tools_3.5.3                   
 [7] backports_1.1.5                R6_2.4.1                       automagic_0.5.1               
[10] DBI_1.0.0                      lazyeval_0.2.2                 colorspace_1.4-1              
[13] withr_2.1.2                    prettyunits_1.0.2              processx_3.4.1                
[16] tidyselect_0.2.5               versions_0.3                   curl_4.3                      
[19] compiler_3.5.3                 cli_2.0.0                      rvest_0.3.5                   
[22] formatR_1.7                    xml2_1.2.2                     desc_1.2.0                    
[25] scales_1.1.0                   containerit_0.6.0              callr_3.4.0                   
[28] askpass_1.1                    digest_0.6.23                  pkgconfig_2.0.3               
[31] htmltools_0.4.0                dbplyr_1.4.2                   fastmap_1.0.1                 
[34] htmlwidgets_1.5.1              rlang_0.4.2                    readxl_1.3.1                  
[37] rstudioapi_0.10                shiny_1.4.0                    generics_0.0.2                
[40] crosstalk_1.0.0                zip_2.0.4                      futile.logger_1.4.3           
[43] Rcpp_1.0.3                     munsell_0.5.0                  fansi_0.4.0                   
[46] lifecycle_0.1.0                stringi_1.4.3                  yaml_2.2.0                    
[49] pkgbuild_1.0.6                 shinyFiles_0.7.5               grid_3.5.3                    
[52] promises_1.1.0                 crayon_1.3.4                   semver_0.2.0                  
[55] miniUI_0.1.1.1                 lattice_0.20-38                haven_2.2.0                   
[58] hms_0.5.2                      ps_1.3.0                       zeallot_0.1.0                 
[61] pillar_1.4.3                   rjson_0.2.20                   codetools_0.2-16              
[64] futile.options_1.0.1           reprex_0.3.0                   glue_1.3.1                    
[67] stevedore_0.9.1                remotes_2.1.0                  lambda.r_1.2.4                
[70] modelr_0.1.5                   vctrs_0.2.1                    httpuv_1.5.2                  
[73] cellranger_1.1.0               gtable_0.3.0                   openssl_1.4.1                 
[76] assertthat_0.2.1               googleCloudStorageR_0.5.1.9001 mime_0.8                      
[79] xtable_1.8-4                   broom_0.5.2                    later_1.0.0                   
[82] gargle_0.4.0                   memoise_1.1.0 
@MarkEdmondson1234
Copy link
Owner

MarkEdmondson1234 commented Jan 5, 2020

For some reason the Dockerfile is adding this line different from my local version:

RUN export DEBIAN_FRONTEND=noninteractive; apt-get -y update \ && apt-get install -y make

e.g. install make. I don't think you need make and puzzle why it thinks you do, so try taking it out of the generated Dockerfile, then trying again. It won't make a new auto Dockerfile if there is one already existing in the folder. I've tried with the below and it finishes the Docker build at least:

FROM trestletech/plumber

RUN ["install2.r", "crayon", "httpuv", "jsonlite", "later", "magrittr", "plumber", "promises", "R6", "Rcpp", "rstudioapi", "stringi"]
COPY ["./", "./"]
ENTRYPOINT ["R", "-e", "pr <- plumber::plumb(commandArgs()[4]); pr$run(host='0.0.0.0', port=as.numeric(Sys.getenv('PORT')))"]
CMD ["api.R"]

I guess the make install is something for Windows? It doesn't know its going to run it on linux. It may break something downstream taking it out, but let me know how it goes all the way through to deploying the api.

(NTS: perhaps build the Dockerfile in its own cloudbuild?)

@AlunHewinson
Copy link
Author

Same result, I'm afraid.
That Dockerfile is getting edited when cr_deploy_plumber() is run. I saved your version, and watched it in Sublime when I sourced the script (which contains just library statements and the cr_deploy_plumber function), and the "make" appeared as I watched.
To confirm, I'm using googleCloudRunner 0.0.9005

@MarkEdmondson1234
Copy link
Owner

MarkEdmondson1234 commented Jan 7, 2020

Two bugs are happening here:

  1. trestletech/plumber is using an old version of unix - issue here: Cannot install Debian packages in trestletech/plumber rstudio/plumber#459
  2. containerit is adding an unnecessary make install that triggers bug - issue here: dockerfile adding a make depedency on Windows vs not on OSX o2r-project/containerit#173

And maybe 3) cr_deploy_plumber() should not overwrite an existing Dockerfile. I think this is currently solved if you specify explicitly the correct Dockerfile:

cr_deploy_plumber("Google/Cloud_Runner/api01", dockerfile="Google/Cloud_Runner/api01/Dockerfile")

The "correct" Dockerfile is like above:

FROM trestletech/plumber

RUN ["install2.r", "crayon", "httpuv", "jsonlite", "later", "magrittr", "plumber", "promises", "R6", "Rcpp", "rstudioapi", "stringi"]
COPY ["./", "./"]
ENTRYPOINT ["R", "-e", "pr <- plumber::plumb(commandArgs()[4]); pr$run(host='0.0.0.0', port=as.numeric(Sys.getenv('PORT')))"]
CMD ["api.R"]

Or using the fix from 1)

FROM trestletech/plumber
RUN echo 'deb http://deb.debian.org/debian bullseye main' > /etc/apt/sources.list
RUN export DEBIAN_FRONTEND=noninteractive; apt-get -y update \
  && apt-get install -y make
RUN ["install2.r", "crayon", "httpuv", "jsonlite", "later", "magrittr", "plumber", "promises", "R6", "Rcpp", "rstudioapi", "stringi"]
COPY ["./", "./"]
ENTRYPOINT ["R", "-e", "pr <- plumber::plumb(commandArgs()[4]); pr$run(host='0.0.0.0', port=as.numeric(Sys.getenv('PORT')))"]
CMD ["api.R"]

@MarkEdmondson1234
Copy link
Owner

This should be "fixed" now in that containerit is removed as a dependency, instead documentation on how to make your own Dockerfile is included in the docs. It would be nice to include it once it is on CRAN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants