22# $ docker run -e VMODE="ci" -v $(pwd):/home/plotly --privileged -p 3838:3838 cpsievert/plotly-vtest
33# ------------------------------------------------------------------------------
44
5- FROM ubuntu:16.04
5+ FROM ubuntu:xenial
66MAINTAINER Carson Sievert "carson@rstudio.com"
77
88# Don't print "debconf: unable to initialize frontend: Dialog" messages
99ARG DEBIAN_FRONTED=noninteractive
1010ARG CACHEBUST=1
1111
1212# Need this to add R repo
13- RUN apt-get update && apt-get install -y software-properties-common
14-
15- # Add R apt repository
16- RUN add-apt-repository "deb http://cran.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran35/"
17- RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0x51716619e084dab9
18-
19- # Install basic stuff and R
20- RUN apt-get update && apt-get install -y \
13+ RUN apt-get update && apt-get install -y software-properties-common apt-transport-https \
14+ && add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/" \
15+ && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 \
16+ && apt-get update && apt-get install -y \
2117 sudo \
2218 git \
2319 vim-tiny \
@@ -33,11 +29,12 @@ RUN apt-get update && apt-get install -y \
3329 libcairo2-dev \
3430 libxt-dev \
3531 libssl-dev \
36- libxml2-dev
32+ libxml2-dev \
33+ && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
34+ && echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
35+ && locale-gen en_US.utf8 \
36+ && /usr/sbin/update-locale LANG=en_US.UTF-8
3737
38- RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
39- && locale-gen en_US.utf8 \
40- && /usr/sbin/update-locale LANG=en_US.UTF-8
4138ENV LANG=en_US.UTF-8
4239
4340# Rprofile
@@ -48,30 +45,27 @@ RUN echo 'options(\n\
4845 shiny.host = "0.0.0.0", shiny.port = 3838\n\
4946)' >> /etc/R/Rprofile.site
5047
51- # Update R packages
52- RUN R -e "update.packages(ask = F)"
53-
54- # Other R packages needed for running visual tests
55- RUN R -e "install.packages('devtools')"
56- RUN R -e "install.packages('roxygen2')"
57- RUN R -e "install.packages('testthat')"
58- RUN R -e "install.packages('vdiffr')"
59- RUN R -e "install.packages('diffobj')"
48+ # Update R packages and install those needed for visual testing
49+ RUN R -e "update.packages(ask = F); invisible(lapply(list('devtools', 'roxygen2', 'testthat', 'vdiffr', 'diffobj'), install.packages, dependencies=TRUE, repos='http://cloud.r-project.org/'))"
6050
6151# sf system dependencies
62- RUN add-apt-repository ppa:ubuntugis/ubuntugis-unstable --yes
63- RUN apt-get -y update
64- RUN apt-get install -y libudunits2-dev libproj-dev libgeos-dev libgdal-dev
52+ RUN add-apt-repository ppa:ubuntugis/ubuntugis-unstable --yes \
53+ && apt-get -y update \
54+ && apt-get install -y libudunits2-dev libproj-dev libgeos-dev libgdal-dev
6555
6656# Install all plotly's dependencies
6757RUN R -e "install.packages('plotly', dependencies = T)"
6858
6959# system dependencies related to running orca
7060RUN apt-get install -y \
71- libgtk2.0-0 \
61+ libgtk2.0-0 \
7262 libgconf-2-4 \
7363 xvfb \
74- fuse \
64+ xauth \
65+ libxtst6 \
66+ libxss1 \
67+ libnss3 \
68+ libasound2 \
7569 desktop-file-utils
7670
7771# google chrome
@@ -81,28 +75,29 @@ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key
8175 apt-get install -y google-chrome-stable
8276
8377# Download orca binary and make it executable under xvfb
84- RUN wget https://github.com/plotly/orca/releases/download/v1.1.1/orca-1.1.1-x86_64.AppImage -P /home
85- RUN chmod 777 /home/orca-1.1.1-x86_64.AppImage
86- RUN printf '#!/bin/bash \nxvfb-run --auto-servernum --server-args "-screen 0 640x480x24" /home/orca-1.1.1-x86_64.AppImage "$@"' > /usr/bin/orca
87- RUN chmod 777 /usr/bin/orca
78+ RUN mkdir -p /opt/orca \
79+ && cd /opt/orca \
80+ && wget https://github.com/plotly/orca/releases/download/v1.3.1/orca-1.3.1.AppImage \
81+ && chmod +x orca-1.3.1.AppImage \
82+ && ./orca-1.3.1.AppImage --appimage-extract \
83+ && rm orca-1.3.1.AppImage \
84+ && printf '#!/bin/bash \nargs=("$@") \nif [[ ! " ${args[@]} " =~ "--no-sandbox" ]]; then \n args+=("--no-sandbox") \nfi \nxvfb-run --auto-servernum --server-args "-screen 0 640x480x24" /opt/orca/squashfs-root/orca "${args[@]}"' > /usr/bin/orca \
85+ && chmod +x /usr/bin/orca
8886
8987# switch on visual testing
9088ENV VDIFFR=true
9189EXPOSE 3838
9290
93- RUN R -e "install.packages('assertthat')"
94- RUN R -e "install.packages('testthat')"
95- ARG CRANCACHE=1
91+
9692RUN R -e "update.packages(ask=FALSE)"
9793RUN R -e "remotes::install_github('r-lib/vdiffr')"
98- RUN R -e "install.packages('rnaturalearth')"
9994
10095# install any new dependencies, then either manage cases (the default) or run tests
10196# note the workaround to get docker to run a proper exit status when there are testthat errors
10297# https://github.com/r-lib/testthat/issues/515#issuecomment-304169376
98+ CMD R -e "remotes::install_deps(dep = TRUE)"
10399
104- CMD cd /home/plotly && R -e "devtools::install_deps(dep = T); \
105- if (!identical(Sys.getenv('VMODE'), 'ci')) vdiffr::manage_cases(); \
100+ CMD cd /home/plotly; R -e "if (!identical(Sys.getenv('VMODE'), 'ci')) vdiffr::manage_cases(); \
106101 res <- devtools::test(reporter='summary'); \
107102 df <- as.data.frame(res); \
108103 if (sum(df\$failed) > 0 || any(df\$error)) q(status=1)"
0 commit comments