Merge pull request #96 from carissalow/docker

Docker + Travis CI
pull/98/head
JulioV 2020-09-01 18:59:15 -04:00 committed by GitHub
commit 0918c1d8c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 74 additions and 3 deletions

View File

@ -1,11 +1,18 @@
services: services:
- mysql - mysql
- docker
sudo: required
language: python # this works for Linux but is an error on macOS or Windows language: python # this works for Linux but is an error on macOS or Windows
stages:
- test
- dockerize
jobs: jobs:
include: include:
- name: "Python 3.7 on Xenial Linux" - stage: test
name: "Python 3.7 on Xenial Linux"
os: linux os: linux
language: python language: python
python: 3.7 python: 3.7
@ -28,7 +35,8 @@ jobs:
- $HOME/.local/share/renv - $HOME/.local/share/renv
- $TRAVIS_BUILD_DIR/renv/library - $TRAVIS_BUILD_DIR/renv/library
- name: "Python 3.7 on macOS" - stage: test
name: "Python 3.7 on macOS"
os: osx os: osx
osx_image: xcode11.3 # Python 3.7 running on macOS 10.14.4 osx_image: xcode11.3 # Python 3.7 running on macOS 10.14.4
language: generic # 'language: python' is an error on Travis CI macOS language: generic # 'language: python' is an error on Travis CI macOS
@ -50,6 +58,16 @@ jobs:
- $RENV_PATHS_ROOT - $RENV_PATHS_ROOT
- $TRAVIS_BUILD_DIR/renv/library - $TRAVIS_BUILD_DIR/renv/library
- stage: dockerize
name: "Python 3.7 on Xenial Linux"
os: linux
language: python
script:
- docker build -t rapids .
- docker login -u "agamk" -p "Qjp4by3FUUqyXNe5lkBPg6LT0LZIdBobHWS3GTsA6jTk26m0bkuUvmJjsjK+/BtGtIqOcaTy+9e1q2+erpUl3hv2NyG6+yzjCfHyPUjWE5MOLE5ve1u+1fQatQueAtwxcsRCN1JE9zmlzvrMwJ4Xx7hb/0KifLWtkOF1LyiVnLuV4lmMaoBRNgtxrhSEOcSm+gMWw8jTEppThHXVEiN+F7tMKTkQtOsRK+R0wX5eieV8API8a0yiXHORXsVQWUn7BjjGgp69pGCY2QqwJi2xFeOIj4GPKBIv3a0YffYbx3D96uX7lcnQk2vSnM88LBbW2PMXwIBEaBxLWeBAUbn5obquybo8P6sYfPa255dAVOfFnyufKyHvyh2VhNnuc/nEdcd/pGjgPrQjh+G2uofKSzAQNbYSLH4XQDuGoMjXbcw4xcijZjF6o9PslFb9SNWirECL+UPAiddgapW8dfq8kc+4vw8f5zO/MEvYswvq8BEaXTqxUvtHrT7nT+gnDYMrMNEAYZlS/8oaTfdbkcWGbnuzcwMRRvubLQat/rLomY1mZMxGNYR8ZVgswKz7TAEIKmWgFYVuQAXIbBPDoKovVT3EYRlWKSeTvxeQGSj87xGqHnmKeGp+xgeoTnp2IwQTRE4t9RmS27SHwASR/mhdPnhCAaw1GWSH05TVDbQEKHw="
- docker tag rapids agamk/rapids:travislatest
- docker push agamk/rapids:travislatest
install: install:
- conda init bash - conda init bash
- conda update -q --all --yes conda - conda update -q --all --yes conda

53
Dockerfile 100644
View File

@ -0,0 +1,53 @@
# getting base image ubuntu
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
libmysqlclient-dev \
mysql-server
RUN apt-get update && apt-get install -y gnupg
RUN apt-get update && apt-get install -y software-properties-common
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
RUN add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'
RUN apt update && apt install -y r-base
RUN apt install -y pandoc
RUN apt install -y git
RUN apt-get update && apt-get install -y vim
RUN apt update && apt install -y unzip
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV PATH /opt/conda/bin:$PATH
RUN apt-get update --fix-missing && \
apt-get install -y wget bzip2 ca-certificates curl git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda clean -tipsy && \
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
ENV TINI_VERSION v0.16.1
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /usr/bin/tini
RUN chmod +x /usr/bin/tini
RUN git clone https://github.com/carissalow/rapids
ENTRYPOINT [ "/usr/bin/tini", "--" ]
CMD [ "/bin/bash" ]
RUN conda update -n base -c defaults conda
WORKDIR /rapids
RUN conda env create -f environment.yml -n rapids
RUN Rscript --vanilla -e 'install.packages("rmarkdown", repos="http://cran.us.r-project.org")'
RUN R -e 'renv::restore()'
ADD https://osf.io/587wc/download data/external
RUN mv data/external/download data/external/rapids_example.sql.zip
RUN unzip data/external/rapids_example.sql.zip
RUN cp rapids_example.sql data/external/rapids_example.sql
RUN rm data/external/rapids_example.sql.zip
RUN rm rapids_example.sql
RUN echo "source activate rapids" > ~/.bashrc
ENV PATH /opt/conda/envs/rapids/bin:$PATH