Skip to content

Commit

Permalink
feat: update deployment and Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
jimbrig committed Sep 11, 2024
1 parent 20d736b commit c3ad356
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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")'
Expand Down
30 changes: 11 additions & 19 deletions dev/app_deploy.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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"
# )

0 comments on commit c3ad356

Please sign in to comment.