Skip to content

Commit 0689f0a

Browse files
authored
Merge pull request #760 from cmu-delphi/docker-mambaorg-micromamba
docker refactor for stable environment to convert Rmd blog post to html
2 parents 9e15022 + b9081fd commit 0689f0a

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,15 @@ In order to convert the Rmd files to HTML files for Hugo you also need to:
7979
1. Activate the environment: `conda activate www-main`
8080
1. Install extra R dependencies: `Rscript ./dependencies.R`
8181

82-
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`.
82+
As an alternative you can use Docker and Docker Compose:
83+
1. `docker-compose up -d` to create a docker container for the current environment.
84+
1. `docker-compose exec r bash` to jump into the container.
85+
1. `micromamba activate www-main` to activate the environment
8386

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

86-
1. Activate the environment: `conda activate www-main`
90+
8791
1. Run blogdown to convert the files to HTML: `Rscript -e 'blogdown::build_site(local=TRUE, run_hugo=FALSE, build_rmd=TRUE)'`
8892
- `local=TRUE` similar to `-D` to process draft files
8993
- `run_hugo=FALSE` to manually run hugo

dependencies.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
# blogdown::install_hugo()
55

6+
install.packages("ggrepel", repo="http://cran.rstudio.com/")
7+
install.packages("base64url", repo="http://cran.rstudio.com/")
68
install.packages("covidcast", repo="http://cran.rstudio.com/")
79
# devtools::install_github("cmu-delphi/covidcast", ref = "main",
810
# upgrade = 'never',

devops/r.dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# docker image for setting up an R environment
2-
FROM continuumio/miniconda
3-
4-
RUN conda install --name base --channel conda-forge mamba=*
2+
FROM mambaorg/micromamba
53

64
ADD ./environment.yml .
7-
RUN mamba env create -f environment.yml
85

6+
RUN micromamba env create -f environment.yml
7+
ARG MAMBA_DOCKERFILE_ACTIVATE=1
98
ADD ./dependencies.R .
109

11-
RUN conda run -n www-main Rscript ./dependencies.R
10+
RUN micromamba run -n www-main Rscript ./dependencies.R
1211

13-
ENV PATH /opt/conda/envs/www-main/bin:$PATH
12+
ENV PATH /opt/conda/envs/www-main/bin:$PATH

environment.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: www-main
22
channels:
33
- conda-forge
44
- defaults
5+
- conda-forge/linux-64
56
dependencies:
67
- gdal
78
- python=3.9.1
@@ -13,7 +14,7 @@ dependencies:
1314
- r-devtools
1415
- r-directlabels
1516
- r-gridextra
16-
- r-reticulate
17+
- r-reticulate==1.22
1718
- r-blogdown
1819
- r-svglite
1920
- r-dplyr

0 commit comments

Comments
 (0)