diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 000000000..8add1bf12 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,10 @@ +image: + file: ./devops/gitpod.dockerfile +tasks: + - init: npm install && RScript -e "blogdown::install_hugo()" + - command: "echo 'run: \"npm start\" or \"npm run start:blog\"'" +ports: + - port: 1313 +vscode: + extensions: + - ikuyadeu.r@1.6.3:SrD06skfmg05hLAerl2aKQ== diff --git a/README.md b/README.md index f6c41eb43..84fade82b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Delphi Website +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/cmu-delpih/www-main) + + Delphi's homepage at https://cmu-delphi-main.netlify.app/ This site is based on [Hugo](https://gohugo.io) and uses [Prettier](https://prettier.io) for formatting. @@ -38,9 +41,9 @@ In RMarkdown things are slightly more different since the R Markdown parser is u **Examples** ``` -[Facebook](`r blogdown::shortcode_html("ref", "2020-08-26-fb-survey")`) -[previous exploratory investigations](`r blogdown::shortcode_html("ref", "2020-08-26-fb-survey#some-interesting-examples")`) -[public API](`r blogdown::shortcode_html("apiref", "api/covidcast.html")`) +`r blogdown::shortcode_html("reflink", "2020-08-26-fb-survey", "Facebook")` +`r blogdown::shortcode_html("reflink", "2020-08-26-fb-survey#some-interesting-examples", "previous exploratory investigations")` +`r blogdown::shortcode_html("apireflink", "api/covidcast.html", "public API")` ``` @@ -53,6 +56,8 @@ In addition, there in the `/data` directory there are the following listings in ## Development Environment +One click: [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/cmu-delpih/www-main) + ### Web Editor Only 1. Install Node: https://nodejs.org/en/download/ diff --git a/devops/gitpod.dockerfile b/devops/gitpod.dockerfile new file mode 100644 index 000000000..f66107836 --- /dev/null +++ b/devops/gitpod.dockerfile @@ -0,0 +1,27 @@ +# docker image for setting up an R environment +FROM gitpod/workspace-full + +# install miniconda +ENV PATH /opt/conda/bin:$PATH +RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda2-4.7.12-Linux-x86_64.sh -O ~/miniconda.sh && \ + sudo /bin/bash ~/miniconda.sh -b -p /opt/conda && \ + rm ~/miniconda.sh && \ + sudo ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \ + echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \ + echo "conda activate base" >> ~/.bashrc && \ + sudo /opt/conda/bin/conda install --name base --channel conda-forge mamba=* && \ + sudo find /opt/conda/ -follow -type f -name '*.a' -delete && \ + sudo find /opt/conda/ -follow -type f -name '*.js.map' -delete && \ + sudo /opt/conda/bin/conda clean -afy && \ + conda config --prepend envs_dirs $HOME/.conda/envs && \ + conda config --prepend pkgs_dirs $HOME/.conda/pkgs + +ADD ./environment.yml . +RUN mamba env create -f environment.yml + +ADD ./dependencies.R . + +RUN conda run -n www-main Rscript ./dependencies.R + +RUN echo "conda activate www-main" >> ~/.bashrc +ENV PATH /home/gitpod/.conda/envs/www-main/bin:$PATH \ No newline at end of file diff --git a/package.json b/package.json index 6fd0e5cd9..3664f86d1 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "build:blog": "Rscript -e \"blogdown::build_site(local=FALSE, run_hugo=FALSE, build_rmd='md5sum')\"", "build": "hugo --gc --minify", "start": "hugo server -D", - "start:blog": "Rscript -e \"blogdown::serve_site()\"", + "start:blog": "Rscript -e \"blogdown::serve_site(port=1313, browser=FALSE)\"", "format": "prettier *.* \"(.vscode|content|data|themes)/**\" --write", "lint": "prettier *.* \"(.vscode|content|data|themes)/**\" --check", "image": "docker build -t www-main:latest --file ./devops/Dockerfile ."