From c3ad356e31431fd089e2f76ddf66e78020215ac1 Mon Sep 17 00:00:00 2001 From: Jimmy Briggs Date: Wed, 11 Sep 2024 16:04:22 -0400 Subject: [PATCH] feat: update deployment and Dockerfile --- Dockerfile | 6 ++---- dev/app_deploy.R | 30 +++++++++++------------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4f1e847..ef851c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,16 +13,14 @@ RUN apt-get update -y -qq && apt-get -y --no-install-recommends install \ libjpeg-dev \ libjq-dev \ libglpk-dev \ + && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ - && apt-get -y autoremove \ - && apt-get -y clean + && rm -rf /tmp/downloaded_packages/ /tmp/*.rds RUN mkdir -p /usr/local/lib/R/etc/ /usr/lib/R/etc/ - RUN echo "options(renv.config.pak.enabled = FALSE, 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("remotes")' - RUN Rscript -e 'remotes::install_version("pkgload",upgrade="never", version = "1.3.4")' RUN Rscript -e 'remotes::install_version("knitr",upgrade="never", version = "1.47")' RUN Rscript -e 'remotes::install_version("shiny",upgrade="never", version = "1.8.1.1")' diff --git a/dev/app_deploy.R b/dev/app_deploy.R index 43bd7da..30dbadf 100644 --- a/dev/app_deploy.R +++ b/dev/app_deploy.R @@ -10,31 +10,28 @@ devtools::check() devtools::build() # Dockerfile -------------------------------------------------------------- -dockerfiler::dock_from_desc() +# golem::add_dockerfile_with_renv() +# dockerfiler::dock_from_desc() +# golem::add_dockerfile_with_renv( +# output_dir = fs::path(getwd(), "build"), +# from = "rocker/r-ver:latest" +# ) # Deployment ------------------------------------------------------------- -library(googleCloudRunner) options(cli.ignore_unknown_rstudio_theme = TRUE) - gcp_config <- config::get("gcp", file = "inst/config/config.yml") -# Sys.setenv( -# "GCE_DEFAULT_PROJECT_ID" = gcp_config$project_id, -# "GAR_CLIENT_JSON" = gcp_config$client_json, -# "GCE_AUTH_FILE" = gcp_config$auth_file, -# "GCS_DEFAULT_BUCKET" = gcp_config$bucket, -# "CR_REGION" = gcp_config$region, -# "CR_BUILD_EMAIL" = gcp_config$build_email -# ) - -golem::add_dockerfile_with_renv() - cr_project_set(gcp_config$project_id) cr_region_set(gcp_config$region) cr_email_set(gcp_config$build_email) cr_bucket_set(gcp_config$bucket) +repo <- cr_buildtrigger_repo("noclocks/demo-rshiny-cloudrun") +cr_deploy_docker_trigger( + repo, + image = "demo-rshiny-cloudrun" +) googleCloudRunner::cr_deploy_docker( local = getwd(), @@ -48,8 +45,3 @@ googleCloudRunner::cr_deploy_docker( kaniko_cache = TRUE, predefinedAcl = "bucketOwnerFullControl" ) - -# golem::add_dockerfile_with_renv( -# output_dir = fs::path(getwd(), "build"), -# from = "rocker/r-ver:latest" -# )