Skip to content

Commit

Permalink
#208 dockerization + github action
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Apr 15, 2024
1 parent 6a3edca commit a2d4e68
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 36 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/docker-build-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: docker-build-image

on:
push:
branches:
- 'main'
tags:
- "v*"

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/fdiwg/calipseo-shiny
flavor: latest=true
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
labels: |
org.opencontainers.image.url=https://github.com/un-fao/calipseo-shiny
org.opencontainers.image.source=https://github.com/un-fao/calipseo-shiny
org.opencontainers.image.title=calipseo-shiny
org.opencontainers.image.description=Calipseo R Shiny dashboard
org.opencontainers.image.vendor=UN-FAO
org.opencontainers.image.author=UN-FAO
org.opencontainers.image.authors=Emmanuel Blondel <emmanuel.blondel@fao.org>
- name: Login to image repository
if: github.ref_type == 'tag'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: ${{ github.ref_type == 'tag' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
102 changes: 66 additions & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,50 +1,80 @@
FROM rocker/shiny:4.0.5
FROM rocker/r-ver:4.0.5

MAINTAINER Emmanuel Blondel "emmanuel.blondel@fao.org"

# system libraries of general use
#---------------------------------------------------------------------------------------
# system libraries for LaTeX reporting & keyring
RUN apt-get update && apt-get install -y \
sudo \
pandoc \
pandoc-citeproc \
texlive-xetex \
texlive-latex-base \
texlive-latex-recommended \
texlive-fonts-recommended \
texlive-fonts-extra \
texlive-formats-extra \
libsodium-dev \
libsecret-1-dev

# general system libraries
# Note: this includes rdf/redland system libraries
RUN apt-get update && apt-get install -y \
cmake \
curl \
default-jdk \
fonts-roboto \
ghostscript \
hugo \
less \
libbz2-dev \
libglpk-dev \
libgmp3-dev \
libfribidi-dev \
libharfbuzz-dev \
libhunspell-dev \
libicu-dev \
liblzma-dev \
libmagick++-dev \
libopenmpi-dev \
libpcre2-dev \
libssl-dev \
libcurl4-openssl-dev \
libv8-dev \
libxml2-dev \
git
libxslt1-dev \
libzmq3-dev \
lsb-release \
qpdf \
texinfo \
software-properties-common \
vim \
wget

RUN apt-get install -y librdf0-dev
RUN install2.r --error --skipinstalled --ncpus -1 redland
RUN apt-get install -y \
libcurl4-openssl-dev \
libgit2-dev \
libxslt-dev \
librdf0 \
redland-utils \
rasqal-utils \
raptor2-utils

#Install geospatial deps over shiny server
#---------------------------------------------------------------------------------------
# geospatial system libraries
RUN /rocker_scripts/install_geospatial.sh

# install R core package dependencies
RUN install2.r --error --skipinstalled --ncpus -1 httpuv
RUN R -e "install.packages(c('remotes','jsonlite','yaml'), repos='https://cran.r-project.org/')"
# copy app
COPY . /srv/calipseo-shiny

#R shiny server
#---------------------------------------------------------------------------------------
# RUN chown shiny:shiny /var/lib/shiny-server
RUN chown shiny:shiny /srv/shiny-server
# install R app package dependencies
RUN R -e "source('./srv/calipseo-shiny/install.R')"

#Git clone shiny app
#---------------------------------------------------------------------------------------
ADD ./shiny/shiny-calipseo /srv/shiny-server/
#check dir is created
RUN ls -ls /srv/shiny-server
#etc dirs (for config)
RUN mkdir -p /etc/calipseo-shiny/

RUN mkdir -p /etc/shiny-server
COPY shinyconfigs/config.yml /etc/shiny-server/config.yml
RUN ls -ls /etc/shiny-server
RUN chmod -R a+w /srv/shiny-server
COPY shiny-server.conf /etc/shiny-server/shiny-server.conf
RUN ls -ls /srv/shiny-server
EXPOSE 3838

#R packages
#---------------------------------------------------------------------------------------
# install R core package dependencies
RUN install2.r --error --skipinstalled --ncpus -1 httpuv
RUN R -e "install.packages(c('remotes','testthat','jsonlite','yaml'), repos='https://cran.r-project.org/')"
# install dependencies of the app
RUN R -e "source('./srv/shiny-server/install.R')"

# EXPOSE 3838
EXPOSE 8080

#RUN apt-get install -y curl
#CMD ["R", "-e shiny::runApp('/srv/shiny-server', port=8080, host='0.0.0.0')"]
CMD ["/init"]
CMD ["R", "-e shiny::runApp('/srv/calipseo-shiny',port=3838,host='0.0.0.0')"]

0 comments on commit a2d4e68

Please sign in to comment.