Skip to content

Commit 1af08f0

Browse files
pinin4fjordsclaude
andcommitted
Add shinyngs Studio (r-shinyngs RNA-seq explorer)
Orphan branch per branch-per-studio convention. Bundles: - .seqera/Dockerfile using connect-client 0.12 + r-shinyngs from bioconda - Pre-built app.R and data.rds from shinyngs::make_app_from_files.R - build.yml workflow that publishes ghcr.io/seqeralabs/custom-studios-examples/shinyngs:latest on pushes to this branch Local test: serves on http://localhost:3838 with HTTP 200. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 parents  commit 1af08f0

6 files changed

Lines changed: 230 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Build and Push shinyngs Studio Image
2+
3+
on:
4+
push:
5+
branches:
6+
- shinyngs
7+
paths:
8+
- '.seqera/**'
9+
- '.github/workflows/build.yml'
10+
pull_request:
11+
paths:
12+
- '.seqera/**'
13+
- '.github/workflows/build.yml'
14+
workflow_dispatch:
15+
inputs:
16+
connect_client_version:
17+
description: 'Version of connect-client to use (e.g., 0.12)'
18+
required: false
19+
type: string
20+
default: '0.12'
21+
22+
env:
23+
REGISTRY: ghcr.io
24+
IMAGE_NAME: ${{ github.repository }}/shinyngs
25+
CONNECT_CLIENT_VERSION: ${{ inputs.connect_client_version || '0.12' }}
26+
27+
jobs:
28+
build-and-push:
29+
runs-on: ubuntu-latest
30+
permissions:
31+
contents: read
32+
packages: write
33+
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
37+
38+
- name: Log in to the Container registry
39+
uses: docker/login-action@v3
40+
with:
41+
registry: ${{ env.REGISTRY }}
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GHCR_TOKEN }}
44+
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v3
47+
48+
- name: Determine image tag
49+
id: image-tag
50+
run: |
51+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
52+
echo "tag=pr-${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT"
53+
echo "push_latest=false" >> "$GITHUB_OUTPUT"
54+
else
55+
echo "tag=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
56+
echo "push_latest=true" >> "$GITHUB_OUTPUT"
57+
fi
58+
59+
- name: Build and push
60+
uses: docker/build-push-action@v5
61+
with:
62+
context: .seqera
63+
file: .seqera/Dockerfile
64+
push: true
65+
platforms: linux/amd64
66+
build-args: |
67+
CONNECT_CLIENT_VERSION=${{ env.CONNECT_CLIENT_VERSION }}
68+
tags: |
69+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.image-tag.outputs.tag }}
70+
${{ steps.image-tag.outputs.push_latest == 'true' && format('{0}/{1}:latest', env.REGISTRY, env.IMAGE_NAME) || '' }}
71+
labels: |
72+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
73+
org.opencontainers.image.description=Seqera Studios image for shinyngs (RNA-seq exploration Shiny app)
74+
org.opencontainers.image.licenses=MIT
75+
cache-from: type=gha,scope=shinyngs
76+
cache-to: type=gha,mode=max,scope=shinyngs

.seqera/Dockerfile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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')))"]

.seqera/app.R

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Change to the application directory
2+
# setwd("data/nf-core-differentialabundance-results/shinyngs_app/study/")
3+
4+
# Load required libraries
5+
library(shiny)
6+
library(markdown)
7+
8+
# Load RNA-seq dataset from an RDS file
9+
esel <- readRDS("data.rds")
10+
11+
# Prepare the Shiny app using the loaded RNA-seq dataset
12+
app <- prepareApp("rnaseq", esel)
13+
14+
# Launch the Shiny application
15+
shiny::shinyApp(app$ui, app$server)
16+
17+

.seqera/data.rds

8.48 MB
Binary file not shown.

.seqera/studio-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
schemaVersion: "0.0.1"
2+
kind: "studio-config"
3+
session:
4+
template:
5+
kind: "dockerfile"
6+
dockerfile: "Dockerfile"

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Shinyngs Studio Environment
2+
3+
This branch contains the Seqera Studios configuration for running the
4+
[shinyngs](https://github.com/pinin4fjords/shinyngs) RNA-seq exploration app as
5+
a standalone Shiny application in Seqera Platform.
6+
7+
> This is a branch of the [custom-studios-examples](https://github.com/seqeralabs/custom-studios-examples)
8+
> repository. Each branch contains a different custom Studio configuration.
9+
> See `master` for an overview of all available Studios.
10+
11+
## Quick Start
12+
13+
### Add from Git Repository
14+
15+
1. Navigate to **Studios** > **Add Studio** in your Seqera Platform workspace
16+
2. Select **Git repository** as the source
17+
3. Enter the repository URL: `https://github.com/seqeralabs/custom-studios-examples`
18+
4. Select branch: `shinyngs`
19+
5. Select your compute environment
20+
6. Click **Add** then **Start**
21+
22+
### Alternative: Build with Wave CLI
23+
24+
```bash
25+
wave -f .seqera/Dockerfile --context .seqera --platform linux/amd64 --await --tower-token "$TOWER_ACCESS_TOKEN"
26+
```
27+
28+
## Local Testing
29+
30+
```bash
31+
cd .seqera
32+
docker build --platform=linux/amd64 \
33+
--build-arg CONNECT_CLIENT_VERSION=0.12 \
34+
-t shinyngs-studio .
35+
36+
# Run without the connect-client entrypoint for local browser testing
37+
docker run --rm --platform=linux/amd64 \
38+
-p 3838:3838 \
39+
-e CONNECT_TOOL_PORT=3838 \
40+
--entrypoint micromamba \
41+
shinyngs-studio \
42+
run -n shinyngs R -e \
43+
"shiny::runApp('/app', host='0.0.0.0', port=as.integer(Sys.getenv('CONNECT_TOOL_PORT')))"
44+
```
45+
46+
Then open http://localhost:3838.
47+
48+
## What's in the image
49+
50+
- `r-shinyngs` from Bioconda, installed into a micromamba env named `shinyngs`
51+
- `connect-client` 0.12 for Studios session bootstrapping
52+
- A baked-in RNA-seq demo app generated at build time from the bundled
53+
`SRP254919` test dataset via `shinyngs`'s `make_app_from_files.R`, producing
54+
`/app/app.R` and `/app/data.rds`
55+
56+
## Customising the data
57+
58+
To swap in your own dataset, replace the files under `.seqera/` with your own
59+
expression matrix, sample metadata, feature metadata, contrasts, and
60+
differential-results TSVs, then rebuild. See `shinyngs`'s
61+
`make_app_from_files.R --help` for input schema.
62+
63+
## References
64+
65+
- [Seqera Studios: Custom Environments](https://docs.seqera.io/platform-cloud/studios/custom-envs)
66+
- [Seqera Studios: Add from Git Repository](https://docs.seqera.io/platform-cloud/studios/add-studio-git-repo)
67+
- [shinyngs](https://github.com/pinin4fjords/shinyngs)

0 commit comments

Comments
 (0)