|
| 1 | +# --------------------------------------------------------------- |
| 2 | +# 1) Multi-stage build: Pull the connect-client binary |
| 3 | +# --------------------------------------------------------------- |
| 4 | +ARG CONNECT_CLIENT_VERSION=0.12 |
| 5 | +FROM public.cr.seqera.io/platform/connect-client:${CONNECT_CLIENT_VERSION} AS connect |
| 6 | + |
| 7 | +# --------------------------------------------------------------- |
| 8 | +# 2) Final stage: Ubuntu + micromamba + r-shinyngs |
| 9 | +# --------------------------------------------------------------- |
| 10 | +FROM ubuntu:22.04 |
| 11 | + |
| 12 | +LABEL org.opencontainers.image.source="https://github.com/seqeralabs/custom-studios-examples" |
| 13 | + |
| 14 | +ENV DEBIAN_FRONTEND=noninteractive |
| 15 | + |
| 16 | +RUN apt-get update --yes && apt-get install --yes --no-install-recommends \ |
| 17 | + wget \ |
| 18 | + ca-certificates \ |
| 19 | + bzip2 \ |
| 20 | + && rm -rf /var/lib/apt/lists/* |
| 21 | + |
| 22 | +# --------------------------------------------------------------- |
| 23 | +# Install micromamba |
| 24 | +# --------------------------------------------------------------- |
| 25 | +ENV MAMBA_ROOT_PREFIX=/opt/conda |
| 26 | +RUN wget -qO- https://micromamba.snakepit.net/api/micromamba/linux-64/latest \ |
| 27 | + | tar -xvj --strip-components=1 bin/micromamba \ |
| 28 | + && mv micromamba /usr/local/bin/micromamba \ |
| 29 | + && mkdir -p /opt/conda \ |
| 30 | + && chmod -R 777 /opt/conda |
| 31 | + |
| 32 | +# --------------------------------------------------------------- |
| 33 | +# Create a conda env with r-shinyngs (bioconda). r-markdown is |
| 34 | +# explicitly loaded by app.R. |
| 35 | +# --------------------------------------------------------------- |
| 36 | +RUN rm -rf /opt/conda/pkgs/*.lock && \ |
| 37 | + micromamba create -y -n shinyngs \ |
| 38 | + -c conda-forge -c bioconda \ |
| 39 | + r-shinyngs \ |
| 40 | + r-markdown \ |
| 41 | + && micromamba clean --all --yes \ |
| 42 | + && rm -rf /opt/conda/pkgs/*.lock |
| 43 | + |
| 44 | +# Add connect-client version label for Platform capability tracking |
| 45 | +ARG CONNECT_CLIENT_VERSION |
| 46 | +LABEL io.seqera.connect.version="${CONNECT_CLIENT_VERSION}" |
| 47 | + |
| 48 | +COPY --from=connect /usr/bin/connect-client /usr/bin/connect-client |
| 49 | +RUN /usr/bin/connect-client --install |
| 50 | + |
| 51 | +WORKDIR /app |
| 52 | + |
| 53 | +# Pre-built shinyngs app and its serialised dataset |
| 54 | +COPY app.R data.rds /app/ |
| 55 | + |
| 56 | +# --------------------------------------------------------------- |
| 57 | +# 3) Launch with connect-client --entrypoint (for Platform) |
| 58 | +# --------------------------------------------------------------- |
| 59 | +ENTRYPOINT ["/usr/bin/connect-client", "--entrypoint"] |
| 60 | + |
| 61 | +# The port is set by the CONNECT_TOOL_PORT environment variable. |
| 62 | +# shinyngs must be attached before app.R is sourced, because app.R |
| 63 | +# calls prepareApp() without namespacing it. |
| 64 | +CMD ["micromamba", "run", "-n", "shinyngs", "R", "-e", "library(shinyngs); shiny::runApp('/app', host='0.0.0.0', port=as.integer(Sys.getenv('CONNECT_TOOL_PORT')))"] |
0 commit comments