Skip to content
Snippets Groups Projects
Commit 404df4f9 authored by Bryan BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

Merge branch 'cleanup-dockerfile' into 'main'

cleanup Dockerfile

See merge request hub/rshiny-k8s!3
parents 57a5ebeb cff3ae6e
No related branches found
No related tags found
1 merge request!3cleanup Dockerfile
Pipeline #101929 passed
......@@ -21,7 +21,7 @@ build:
--cache-from "$CI_REGISTRY_IMAGE/master:latest"
--tag "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA"
--tag "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:latest"
-f Dockerfile2
-f Dockerfile
./
# push image as latest for the current branch
- docker push "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:latest"
......
FROM rocker/shiny:4.2.3
RUN cp -r $R_HOME /usr/myR
ENV R_HOME=/usr/myR
RUN R -e 'print("hello world")'
WORKDIR /srv/shiny-server/
USER root
# RUN sed -i "s/test -x/test -d/g" /usr/local/bin/R
# RUN sed -i '/test -x/,+4d' /usr/local/bin/R
# RUN grep " \${gui}" /usr/local/bin/R -A 10
# change permission for user shiny
# RUN sudo chown -R shiny:shiny /usr/local/lib/R/etc/
## Install R packages from CRAN or bioconductor
# COPY ./script_r_to_docker/script_install_r_packages.R .
# COPY ./script_r_to_docker/packages_to_install.csv .
#RUN ls -lah /usr/local/lib/R
#RUN printenv
# RUN /usr/local/lib/R/bin/Rscript script_install_r_packages.R
# RUN Rscript script_install_r_packages.R
RUN R -e 'print("hello world")'
FROM ubuntu:focal
# define geographic location during R installation
ENV TZ=Etc/UTC
ENV DEBIAN_FRONTEND noninteractive
ARG SHINY_SERVER_VERSION
EXPOSE 3838
CMD ["shiny-server"]
# install R
RUN apt-get update \
&& apt-get install -y \
nano \
wget \
curl \
r-base \
r-base-dev \
r-recommended \
lsb-release \
&& rm -rf /var/lib/apt/lists/* \
&& R --version
COPY ./scripts /opt/scripts
# Install R packages included Shiny, then install shiny server
RUN Rscript /opt/scripts/install_r_packages.R
RUN /opt/scripts/install_shiny_server.sh
# allows trafic from all ips
RUN sed -i "s/3838/3838 0.0.0.0/g" /etc/shiny-server/shiny-server.conf
# copy my shiny app.
COPY ./example_proj /srv/shiny-server
ENV OPENBLAS_NUM_THREADS=1
#RUN chown shiny:shiny /var/lib/shiny-server
RUN mkdir -p /var/log/shiny-server \
&& chown shiny:shiny /var/log/shiny-server
RUN install2.r \
shinythemes
# USER shiny
# copy the app directory into the image
COPY ./example_proj /srv/shiny-server
RUN ls /srv/shiny-server
USER shiny
# CMD ["/usr/bin/shiny-server"]
#FROM rocker/shiny
FROM ubuntu:focal
# define geographic location during R installation
ENV TZ=Etc/UTC
ENV DEBIAN_FRONTEND noninteractive
# install R
RUN apt-get update \
&& apt-get install -y \
nano \
wget \
curl \
r-base \
r-base-dev \
r-recommended \
&& rm -rf /var/lib/apt/lists/*
RUN R --version
# install R packages included Shiny
#COPY ./scripts/install_r_packages.R .
#COPY ./scripts/packages_to_install.csv .
COPY ./scripts /opt/scripts
RUN cd /opt/scripts/ \
&& Rscript /opt/scripts/install_r_packages.R
#Install shiny server
#RUN apt-get update \
# && apt-get install -y \
# gdebi-core \
# && rm -rf /var/lib/apt/lists/*
RUN apt-get update \
&& apt-get install -y \
lsb-release \
&& rm -rf /var/lib/apt/lists/*
RUN wget https://download3.rstudio.org/ubuntu-18.04/x86_64/shiny-server-1.5.20.1002-amd64.deb \
&& apt-get install ./shiny-server-1.5.20.1002-amd64.deb
# copy my shiny app.
COPY ./example_proj /srv/shiny-server
RUN cat /etc/passwd
#RUN addgroup --gid 999 shiny \
# && adduser --disabled-password --gecos '' --uid 999 --gid 999 shiny
RUN chown shiny:shiny /var/lib/shiny-server
RUN mkdir -p /var/log/shiny-server
RUN chown shiny:shiny /var/log/shiny-server
RUN sed -i "s/3838/3838 0.0.0.0/g" /etc/shiny-server/shiny-server.conf
CMD ["shiny-server"]
EXPOSE 3838
USER shiny
# stolen from https://github.com/qutebrowser/qutebrowser/commit/478e4de7bd1f26bebdcdc166d5369b2b5142c3e2
# WORKAROUND for glibc 2.33 and old Docker
# See https://github.com/actions/virtual-environments/issues/2658
# (GitLab ticket: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27557)
# Thanks to https://github.com/lxqt/lxqt-panel/pull/1562
#RUN patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst && \
# curl -LO "https://repo.archlinuxcn.org/x86_64/$patched_glibc" && \
# bsdtar -C / -xvf "$patched_glibc"
......@@ -5,7 +5,7 @@
#### Load file with the list of packages and the name of the deposit
packages_list <- read.csv(file = "packages_to_install.csv", header = TRUE, sep = ";", stringsAsFactors = FALSE )
packages_list <- read.csv(file = "/opt/scripts/packages_to_install.csv", header = TRUE, sep = ";", stringsAsFactors = FALSE )
### CRAN Packages
cran_pkgs <- packages_list[which(packages_list$Deposit_name == "cran"),"Package_name"]
......@@ -20,4 +20,4 @@ if (length(cran_pkgs) >= 1) {
if (length(bioconductor_pkgs) >= 1) {
requireNamespace("BiocManager")
BiocManager::install(bioconductor_pkgs, ask = FALSE)
}
\ No newline at end of file
}
#!/bin/bash
set -e
SHINY_SERVER_VERSION=${1:-${SHINY_SERVER_VERSION:-latest}}
if [ "$SHINY_SERVER_VERSION" = "latest" ]; then
SHINY_SERVER_VERSION=$(wget -qO- https://download3.rstudio.org/ubuntu-18.04/x86_64/VERSION)
fi
wget --no-verbose "https://download3.rstudio.org/ubuntu-18.04/x86_64/shiny-server-${SHINY_SERVER_VERSION}-amd64.deb" -O /tmp/shiny.deb
apt install /tmp/shiny.deb
rm /tmp/shiny.deb
Package_name;Deposit_name
shiny;cran
shinythemes;cran
BiocManager;cran
biomaRt;bioconductor
ggplot2;cran
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment