Commit 503a528b authored by Jean-Francois Rey's avatar Jean-Francois Rey
Browse files

First commit

r-base-biosp and r-devel-biosp dockerfile
CI/CD pipeline
parents
## Two stages
# First to build docker images
# Second to deploy in a server
stages:
- build_img
- deploy
## Build docker image base on r-base
## using DockerFile and register it in the
## docker registry of the project
buildRBaseBioSP:
when: manual
tags:
- "dind"
- "docker"
variables:
DOCKER_TLS_CERTDIR: ""
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
services:
- docker:19.03.0-dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
stage: build_img
script:
- docker build --no-cache --tag $CI_REGISTRY_IMAGE/r-base-biosp:$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE/r-base-biosp:latest -f r-base-biosp/Dockerfile .
- docker push $CI_REGISTRY_IMAGE/r-base-biosp:$CI_COMMIT_SHA
- docker push $CI_REGISTRY_IMAGE/r-base-biosp:latest
after_script:
- docker logout $CI_REGISTRY
## Build docker image base on debian unstable and r-devel source
## using DockerFile and register it in the
## docker registry of the project
buildRDevelBioSP:
when: manual
tags:
- "dind"
- "docker"
variables:
DOCKER_TLS_CERTDIR: ""
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
services:
- docker:19.03.0-dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
stage: build_img
script:
- docker build --no-cache --tag $CI_REGISTRY_IMAGE/r-devel-biosp:$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE/r-devel-biosp:latest -f r-devel-biosp/Dockerfile .
- docker push $CI_REGISTRY_IMAGE/r-devel-biosp:$CI_COMMIT_SHA
- docker push $CI_REGISTRY_IMAGE/r-devel-biosp:latest
after_script:
- docker logout $CI_REGISTRY
## Deploy image on a server
## Secret Variables:
## DEPLOY_USER : user ID that have access to the server
## DEPLOY_PWD : user password
## DEPLOY_IP : server IP to deploy to
deploy:
image: debian:stable
stage: deploy
when: manual
only:
- master
environment:
name: GitLabDockerRunners
before_script:
- apt-get update && apt-get install -y sshpass openssh-client
- export SSHPASS=$DEPLOY_PWD
script:
- sshpass -e ssh -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_IP
"docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY;
docker pull $CI_REGISTRY_IMAGE/r-base-biosp:latest;
docker logout $CI_REGISTRY;"
- sshpass -e ssh -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_IP
"docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY;
docker pull $CI_REGISTRY_IMAGE/r-devel-biosp:latest;
docker logout $CI_REGISTRY;"
This diff is collapsed.
# Custom R Dockerfile
R Docker image nigthly build :
* [R-base-biosp](r-base-biosp) : r-base + dependencies packages for R packaging pipeline
* [R-devel-biosp](r-devel-biosp) : R devel version + dependencies packages for R packaging pipeline
## CI/CD
In your __.gitlab-ci.yml__ file use tags to select the docker image.
```yaml
tags:
- "r-base-biosp"
```
```yaml
tags:
- "r-devel-biosp"
```
## Author
* Jean-François Rey <jean-francois.rey at inra.fr>
## License
[LICENSE](LICENSE)
FROM r-base:latest
LABEL maintener="Jean-François Rey <jean-francois.rey@inra.fr>"
LABEL description="r-base image for BioSP by adding packages dependencies"
RUN echo "deb http://http.debian.net/debian sid main contrib non-free" > /etc/apt/sources.list.d/debian-unstable.list
# install dependances
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
sudo \
ntp \
libxml2 libxml2-dev \
gdal-bin libgdal-dev\
libfftw3-bin libfftw3-dev \
texlive texinfo \
texlive-fonts-extra \
libqpdf26 qpdf \
libudunits2-dev libudunits2-0 \
libgsl-dev \
libgeos-dev \
libgeos++-dev \
&& apt-get clean \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
&& rm -rf /var/lib/apt/lists/*
# set France time zone
ENV CONTAINER_TIMEZONE Europe/Paris
ENV TZ Europe/Paris
RUN sudo echo "Europe/Paris" > /etc/timezone
RUN echo "fr_FR.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen fr_FR.UTF8 \
&& /usr/sbin/update-locale LANG=fr_FR.UTF-8
ENV LC_ALL fr_FR.UTF-8
ENV LANG fr_FR.UTF-8
# install R packages
#RUN Rscript -e "options(warn=2) ; install.packages(c('rgeos'), repos='https://cran.biotools.fr', dependencies=TRUE)"
#with littler
RUN install.r -r https://cran.biotools.fr -d TRUE -e \
deSolve \
methods \
grDevices \
graphics \
sp \
stats \
rgeos \
fields \
MASS \
Matrix \
rgeos \
deldir \
pracma \
raster \
fftwtools \
mvtnorm \
rgdal \
knitr \
maptools \
sf \
splancs \
RCALI \
rmarkdown \
testthat \
roxygen2 \
Rcpp \
RcppArmadillo \
fasterize \
shiny \
htmltools \
shinydashboard \
ggplot2 \
dplyr \
dbplyr \
DT \
magrittr \
devtools \
shinyjs \
stringi \
stringr \
jsonlite \
data.table \
htmlwidgets \
RSQLite \
BiocManager \
foreach \
doParallel \
mvtnorm \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds
RUN Rscript -e 'BiocManager::install(c("Biostrings"))'
# force update to last version
RUN Rscript -e "update.packages(ask=FALSE)"
#ENTRYPOINT ["/bin/sh", "-c"]
WORKDIR /home/docker
CMD ["R"]
# Custom R-base image
This is a custom R-base image use as runner for CI/CD pipeline.
FROM debian:unstable
LABEL maintener="Jean-François Rey <jean-francois.rey@inra.fr>"
LABEL description="r-devel image for BioSP by adding packages dependencies"
RUN useradd docker \
&& mkdir /home/docker \
&& chown docker:docker /home/docker \
&& addgroup docker staff
RUN echo 'deb http://deb.debian.org/debian testing main' >> /etc/apt/source.list && apt-get update -qq \
&& apt-get install -t unstable -y --no-install-recommends \
ed \
less \
locales \
vim-tiny \
wget \
ca-certificates \
fonts-texgyre \
ntp \
tzdata \
rsync \
bash-completion \
bison \
debhelper \
default-jdk \
g++ \
gcc \
gdb \
gfortran \
groff-base \
libblas-dev \
libbz2-dev \
libcairo2-dev/unstable \
libcurl4-openssl-dev \
gdal-bin \
libgdal-dev \
libgeos-dev \
libgeos++-dev \
libjpeg-dev \
liblapack-dev \
liblzma-dev \
#libnetcdf-dev \
libncurses5-dev \
libpango1.0-dev \
libpcre3-dev \
libpng-dev \
libreadline-dev \
libtiff5-dev \
libx11-dev \
libxt-dev \
libxml2 \
libxml2-dev \
#libgdal-dev \
#libgdal20 \
#libhdf5-100 \
#libnetcdf13 libnetcdf-dev \
#libarmadillo-dev libhdf5-dev libnetcdf-dev \
libfftw3-bin libfftw3-dev \
#libhdf5-103 libhdf5-cpp-103 \
mesa-common-dev \
libglu1-mesa-dev \
mpack \
openssl \
libssl-dev \
subversion \
tcl8.6-dev \
texinfo \
texlive-base \
texlive-extra-utils \
texlive-fonts-extra \
texlive-fonts-recommended \
texlive-generic-recommended \
texlive-latex-base \
texlive-latex-extra \
texlive-latex-recommended \
tk8.6-dev \
x11proto-core-dev \
xauth \
xdg-utils \
xfonts-base \
xvfb \
zlib1g-dev \
qpdf \
libudunits2-dev libudunits2-0 \
libgsl-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
## Set timezone
ENV CONTAINER_TIMEZONE Europe/Paris
ENV TZ Europe/Paris
RUN echo "Europe/Paris" > /etc/timezone
RUN echo "fr_FR.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen fr_FR.UTF8 \
&& /usr/sbin/update-locale LANG=fr_FR.UTF-8
ENV LC_ALL fr_FR.UTF-8
ENV LANG fr_FR.UTF-8
## Checkout R-Devel
RUN cd /home/docker/ \
&& svn co https://svn.r-project.org/R/trunk R-devel
#Build R-devel
RUN cd /home/docker/R-devel \
&& ./tools/rsync-recommended \
&& ./configure --enable-memory-profiling \
--enable-R-profiling \
--with-valgrind-instrumentation \
--with-system-valgrind-headers \
CFLAGS=" -Wall -Wextra -g -ggdb -Wconversion -O0" \
CXXFLAGS=" -Wall -Wextra -g -ggdb -Wconversion -O0 -fno-inline" \
&& make -j 4 \
&& make install \
&& cd /home/docker/ \
&& rm -rf R-devel/
#RUN cd /home/docker/R-devel && make install-tests \
# && cd tests \
# && ../bin/R CMD make check \
# && ../bin/R CMD make check-devel \
# && ../bin/R CMD make check-all
# R config
RUN echo 'options(repos=c(CRAN="https://cran.biotools.fr"), \
download.file.method = "libcurl")' >> /usr/local/lib/R/etc/Rprofile.site
#RUN echo "options(warn=2) ; install.packages(c( \
RUN echo "install.packages(c( \
'deSolve', \
'sp', \
'rgeos', \
'fields', \
'MASS', \
'Matrix', \
'deldir', \
'pracma', \
'raster', \
'fftwtools', \
'mvtnorm', \
'rgdal', \
'sf', \
'splancs', \
'knitr', \
'rmarkdown', \
'testthat', \
'Rcpp', \
'RcppArmadillo', \
'fasterize', \
'roxygen2', \
'shiny', \
'htmltools', \
'shinydashboard', \
'ggplot2', \
'dplyr', \
'dbplyr', \
'DT', \
'magrittr', \
'devtools', \
'shinyjs', \
'stringi', \
'stringr', \
'jsonlite', \
'data.table', \
'htmlwidgets', \
'RSQLite', \
'BiocManager', \
'foreach', \
'doParallel' \
'mvtnorm' \
), \
dependencies=TRUE, \
repos='https://cran.biotools.fr')" > /tmp/install.R \
&& Rscript /tmp/install.R
RUN Rscript -e 'BiocManager::install(c("Biostrings"))'
RUN Rscript -e "update.packages(ask=FALSE)"
WORKDIR /home/docker
USER docker
CMD ["R"]
# Custom R-devel image
This is a custom R-devel image use as runner for CI/CD pipeline.
It bases on debian:unstable and last r-devel version.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment