-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from almahmoud/devel
Add shiny build workflow
- Loading branch information
Showing
3 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<tool id="interactivetool_biocshiny_{{{ID}}}" tool_type="interactive" name="{{{NAME}}}" version="0.1"> | ||
<description>{{{NAME}}} BiocShiny App</description> | ||
<requirements> | ||
<container type="docker">{{{CONTAINER}}}</container> | ||
</requirements> | ||
<entry_points> | ||
<entry_point name="{{{ID}}}" requires_domain="True"> | ||
<port>3838</port> | ||
</entry_point> | ||
</entry_points> | ||
<environment_variables> | ||
<environment_variable name="HISTORY_ID">$__history_id__</environment_variable> | ||
<environment_variable name="REMOTE_HOST">$__galaxy_url__</environment_variable> | ||
<environment_variable name="GALAXY_URL">$__galaxy_url__</environment_variable> | ||
<environment_variable name="API_KEY" inject="api_key" /> | ||
</environment_variables> | ||
<command detect_errors="aggressive">/init</command> | ||
<inputs> | ||
</inputs> | ||
<outputs> | ||
</outputs> | ||
<tests> | ||
</tests> | ||
<help> | ||
This is an auto-generated wrapper for a BiocShiny application. See source and report issues at {{{SOURCE}}}. | ||
</help> | ||
</tool> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Build shiny Docker image and generate Galaxy wrapper | ||
on: | ||
workflow_dispatch: {} | ||
push: {} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Extract metadata for container image | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=raw,value={{branch}} | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
platforms: linux/amd64 | ||
|
||
- name: Login to GHCR | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push container image to ghcr | ||
uses: docker/build-push-action@v4 | ||
with: | ||
file: Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64 | ||
|
||
- name: Set variables | ||
id: vars | ||
run: | | ||
echo "container=${{ steps.meta.outputs.tags }}" >> $GITHUB_OUTPUT | ||
echo "source=https://github.com/${{github.repository}}" >> $GITHUB_OUTPUT | ||
NAME="$(echo '${{github.repository}}' | awk -F'/' '{print $2}')" | ||
echo "name=$NAME" >> $GITHUB_OUTPUT | ||
echo "id=$(echo $NAME | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT | ||
- name: Generate wrapper | ||
run: | | ||
cp .github/scripts/galaxy-wrapper-template.xml galaxy-wrapper.xml | ||
sed -i 's#{{{CONTAINER}}}#${{steps.vars.outputs.container}}#g' galaxy-wrapper.xml | ||
sed -i 's#{{{SOURCE}}}#${{steps.vars.outputs.source}}#g' galaxy-wrapper.xml | ||
sed -i 's#{{{NAME}}}#${{steps.vars.outputs.name}}#g' galaxy-wrapper.xml | ||
sed -i 's#{{{ID}}}#${{steps.vars.outputs.id}}#g' galaxy-wrapper.xml | ||
git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add galaxy-wrapper.xml | ||
git commit -m "Update Galaxy Wrapper $(TZ=EST date '+%Y-%m-%d_%H-%M')" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM ghcr.io/bioconductor/shiny:devel as build | ||
|
||
RUN chown -R shiny /usr/local/lib/R/site-library && chown -R shiny /usr/local/lib/R/library && rm -rf /srv/shiny-server/sample-apps && curl -o /srv/shiny-server/index.html https://gist.githubusercontent.com/almahmoud/58261d03bfb342274f2e642c4b2ebc4d/raw/4e0271990bce57ae091f622db47b15f8fd89fa29/index.html && mkdir -p /srv/shiny-server/biocshiny && sed -i '/^run_as shiny;/a app_init_timeout 300;\napp_idle_timeout 300;' /etc/shiny-server/shiny-server.conf | ||
|
||
COPY --chown=shiny:shiny . /tmp/repo/ | ||
|
||
USER shiny | ||
|
||
RUN cd /tmp/repo && Rscript -e "options(repos = c(CRAN = 'https://cran.r-project.org')); BiocManager::install(ask=FALSE)" && Rscript -e "options(repos = c(CRAN = 'https://cran.r-project.org')); devtools::install('.', dependencies=TRUE, build_vignettes=TRUE, repos = BiocManager::repositories())" && rm -rf /tmp/repo | ||
|
||
COPY --chown=shiny:shiny app.R /srv/shiny-server/biocshiny/app.R | ||
|
||
USER root | ||
|