Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,15 @@ In order to convert the Rmd files to HTML files for Hugo you also need to:
1. Activate the environment: `conda activate www-main`
1. Install extra R dependencies: `Rscript ./dependencies.R`

As an alternative you can use Docker and Docker Compose. Then it reduces to `docker-compose up -d` to create a docker container for the current environment. In the following you would need to jump into the container to execute the upcoming command via `docker-compose exec r bash`.
As an alternative you can use Docker and Docker Compose:
1. `docker-compose up -d` to create a docker container for the current environment.
1. `docker-compose exec r bash` to jump into the container.
1. `micromamba activate www-main` to activate the environment

Now you have the environment ready to start converting .Rmd blog files to html.
#### Commands

1. Activate the environment: `conda activate www-main`

1. Run blogdown to convert the files to HTML: `Rscript -e 'blogdown::build_site(local=TRUE, run_hugo=FALSE, build_rmd=TRUE)'`
- `local=TRUE` similar to `-D` to process draft files
- `run_hugo=FALSE` to manually run hugo
Expand Down
2 changes: 2 additions & 0 deletions dependencies.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

# blogdown::install_hugo()

install.packages("ggrepel", repo="http://cran.rstudio.com/")
install.packages("base64url", repo="http://cran.rstudio.com/")
install.packages("covidcast", repo="http://cran.rstudio.com/")
# devtools::install_github("cmu-delphi/covidcast", ref = "main",
# upgrade = 'never',
Expand Down
11 changes: 5 additions & 6 deletions devops/r.dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# docker image for setting up an R environment
FROM continuumio/miniconda

RUN conda install --name base --channel conda-forge mamba=*
FROM mambaorg/micromamba

ADD ./environment.yml .
RUN mamba env create -f environment.yml

RUN micromamba env create -f environment.yml
ARG MAMBA_DOCKERFILE_ACTIVATE=1
ADD ./dependencies.R .

RUN conda run -n www-main Rscript ./dependencies.R
RUN micromamba run -n www-main Rscript ./dependencies.R

ENV PATH /opt/conda/envs/www-main/bin:$PATH
ENV PATH /opt/conda/envs/www-main/bin:$PATH
3 changes: 2 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: www-main
channels:
- conda-forge
- defaults
- conda-forge/linux-64
dependencies:
- gdal
- python=3.9.1
Expand All @@ -13,7 +14,7 @@ dependencies:
- r-devtools
- r-directlabels
- r-gridextra
- r-reticulate
- r-reticulate==1.22
- r-blogdown
- r-svglite
- r-dplyr
Expand Down