Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Compatible with R >= 4.0.0: rocker-versioned2 #1

Open
jtelleriar opened this issue Jan 8, 2021 · 0 comments
Open

Make Compatible with R >= 4.0.0: rocker-versioned2 #1

jtelleriar opened this issue Jan 8, 2021 · 0 comments

Comments

@jtelleriar
Copy link

jtelleriar commented Jan 8, 2021

With R >= 4.0.0 the rocker image comes configured with Ubuntu 20.04 (https://github.com/rocker-org/rocker-versioned2).

I have tried to modify the Dockerfile in order to make it work, with no success.

ARG VER_RLANG="4.0.3"

FROM rocker/verse:${VER_RLANG} as rstudio

FROM scratch

COPY --from=rstudio / /

ARG VER_PYTHON="3.8"
ARG VER_SHINYPROXY="2.4.2"
ARG VER_VSCODE="3.8.0"
ARG TAG="latest"
ENV TAG=${TAG}

# essential vars
ENV DISABLE_AUTH true
ENV R_LIBS_USER /r-libs
ENV APPLICATION_LOGS_TO_STDOUT false

# add shiny immediately and expose port 3838.

RUN /rocker_scripts/install_shiny_server.sh

RUN apt-get update && \
    apt-get install -y apt-transport-https && \
    apt-get install -y curl nano

# install Java 8 and ShinyProxy
RUN apt-get install -y openjdk-8-jdk-headless && \
    mkdir -p /opt/shinyproxy && \
    wget -nv "https://www.shinyproxy.io/downloads/shinyproxy-${VER_SHINYPROXY}.jar" -O /opt/shinyproxy/shinyproxy.jar

COPY configs/shinyproxy/grid-layout /opt/shinyproxy/templates/grid-layout
COPY configs/shinyproxy/application.yml /opt/shinyproxy/application.yml

# create shared /r-libs directory and ensure it's writeable by all.
RUN mkdir /r-libs && \
    echo ".libPaths( c( '/r-libs', .libPaths() ) )" >> /usr/local/lib/R/etc/Rprofile.site

# install R packages
RUN R -e "install.packages(c('tidyverse', 'tidymodels', 'reticulate', 'DBI', 'odbc', 'flexdashboard', 'DT'))" && \
    chmod -R 777 /r-libs

COPY samples /srv/shiny-server

# setup python with miniconda.
ENV VIRTUAL_ENV=py3
RUN wget -nv https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && \
    bash /tmp/miniconda.sh -b -p /conda3 && \
    rm -f /tmp/miniconda.sh && \
    /conda3/bin/conda create -y -n $VIRTUAL_ENV python=${VER_PYTHON} && \
    chmod -R 777 /conda3 && \
    /conda3/bin/conda install -y --name $VIRTUAL_ENV jupyter pylint openssl

# set path
ENV PATH "/conda3/bin:${PATH}"
RUN echo "export PATH=\"/conda3/bin:\${PATH}\"" >> /etc/profile && \
    echo ". activate $VIRTUAL_ENV" >> /etc/profile && \
    echo '$env:PATH = "/conda3/envs/$($env:VIRTUAL_ENV)/bin:" + $env:PATH'

# install VS code-server.
RUN wget -nv "https://github.com/cdr/code-server/releases/download/v${VER_VSCODE}/code-server-${VER_VSCODE}-linux-amd64.tar.gz" -O /tmp/vs-code-server.tar.gz && \
    mkdir /tmp/vs-code-server && \
    tar -xzf /tmp/vs-code-server.tar.gz --strip 1 --directory /tmp/vs-code-server && \
    mv -f /tmp/vs-code-server/code-server /usr/local/bin/code-server && \
    rm -rf /tmp/vs-code-server.tar.gz && \
    # unsure why this is necessary, but it solves a fatal 'file not found' error.
    mkdir -p /src/packages/server/build/web && \
    echo '' > /src/packages/server/build/web/index.html

# install SQL Server odbc driver.
RUN apt-get install -y unixodbc && \
    wget -nv https://packages.microsoft.com/ubuntu/20.04/prod/pool/main/m/msodbcsql17/msodbcsql17_17.6.1.1-1_amd64.deb -O /tmp/msodbcsql.deb && \             
    ACCEPT_EULA=Y dpkg -i /tmp/msodbcsql.deb && \
    rm -f /tmp/msodbcsql.deb

# install PostgreSQL odbc driver.
RUN apt-get install -y odbc-postgresql

# custom configs.
COPY configs/rstudio/rserver.conf /etc/rstudio/rserver_custom.conf

COPY configs/vscode/install-vscode-python.sh /install-vscode-python.sh

COPY configs/odbc/odbcinst.ini /etc/odbcinst.ini
COPY configs/odbc/odbc.ini /etc/odbc.ini

# copy custom run commands.
COPY configs/rstudio/run /etc/services.d/rstudio/run
COPY configs/vscode/run /etc/services.d/vscode/run
COPY configs/shinyproxy/run /etc/services.d/shinyproxy/run

# copy custom start command and make it executable.
COPY configs/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT [ "/entrypoint.sh" ]

CMD [ "shinyproxy" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant