Skip to content

Commit

Permalink
Added Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
royfrancis committed Oct 4, 2023
1 parent d4e9329 commit 7fd8c00
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
46 changes: 46 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# DOCKER FILE FOR WORKSHOP-R
# 2023 Roy Francis

FROM rocker/verse:4.2.3
LABEL Description="Docker image for NBIS workshop-r"
LABEL Maintainer="[email protected]"
LABEL org.opencontainers.image.source="https://github.com/NBISweden/workshop-r"

RUN apt-get update -y \
&& apt-get install --no-install-recommends -y \
libxml2-dev \
libssl-dev \
libcurl4-openssl-dev \
libudunits2-dev \
libopenblas-base \
libgdal-dev \
&& wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
&& apt-get install -y ./google-chrome-stable_current_amd64.deb \
&& rm -rf google-chrome-stable_current_amd64.deb \
&& rm -rf /var/lib/apt/lists/* \
&& Rscript -e 'install.packages(c("bookdown","knitr","remotes","fontawesome","formattable","formatR","kableExtra","leaflet","pagedown","lubridate","markdown","rmarkdown","xaringan","yaml"),repos = "https://packagemanager.posit.co/cran/__linux__/jammy/latest");' \
&& mkdir /rmd

RUN Rscript -e 'install.packages(c("tidyverse","nycflights13","vcd","patchwork","vioplot"),repos = "https://packagemanager.posit.co/cran/__linux__/jammy/latest");'
RUN Rscript -e 'remotes::install_github("mkierczak/mkteachr");'
WORKDIR /rmd
CMD Rscript -e "rmarkdown::render_site()"




# build container
# docker build -t ghcr.io/nbisweden/workshop-r:1.0.0 .
# docker tag ghcr.io/nbisweden/workshop-r:1.0.0 ghcr.io/nbisweden/workshop-r:latest

# push to ghcr
# docker login ghcr.io
# docker push ghcr.io/nbisweden/workshop-r:1.0.0
# docker push ghcr.io/nbisweden/workshop-r:latest

# run container
# render all files
# docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v ${PWD}:/rmd ghcr.io/nbisweden/workshop-r:latest
# render one file
# docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v ${PWD}:/rmd ghcr.io/nbisweden/workshop-r:latest Rscript -e 'rmarkdown::render("index.Rmd")'

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ To build a single file (for example `index.Rmd`),
docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v ${PWD}:/rmd ghcr.io/nbisweden/workshop-r:latest Rscript -e 'rmarkdown::render("index.Rmd")'
```

See **Dockerfile** to build the image.

:exclamation: Output files are for local preview only. Do not push any rendered .html files or intermediates.

## Repo organisation
Expand Down

0 comments on commit 7fd8c00

Please sign in to comment.