-
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.
perf: containerize the app and enabe gh actions to publish image
- Loading branch information
Showing
9 changed files
with
313 additions
and
543 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
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,70 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
|
||
name: Create Github release and generate Docker image | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
tags: | ||
- 'v*' | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_PATH: ghcr.io/${{ github.repository }} | ||
|
||
jobs: | ||
tagging: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tag: ${{steps.tag_version.outputs.new_tag}} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: '0' | ||
- name: Bump version and push tag | ||
id: tag_version | ||
uses: mathieudutour/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
custom_release_rules: fix:patch:Bug Fixes,chore:patch:Chores,feat:minor:Features,perf:Major:Performance | ||
- name: Create a GitHub release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ steps.tag_version.outputs.new_tag }} | ||
name: Release ${{ steps.tag_version.outputs.new_tag }} | ||
body: ${{ steps.tag_version.outputs.changelog }} | ||
|
||
build-and-push-image: | ||
needs: tagging | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/[email protected] | ||
if: github.event_name == 'push' | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
images: ${{ env.IMAGE_PATH }} | ||
tags: ${{ needs.tagging.outputs.tag}} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags}} | ||
labels: ${{ steps.meta.outputs.labels }} |
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
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
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,19 @@ | ||
FROM sagebionetworks/shiny-base:release-1.0 | ||
# This is the expected application installation folder | ||
WORKDIR /srv/shiny-server/app | ||
COPY --chown=shiny ./ ./ | ||
|
||
# Set up Python and install the Synapse Python client | ||
RUN Rscript -e "install.packages('reticulate', repos='http://cran.rstudio.com/', verbose=FALSE)" | ||
RUN Rscript -e "library(reticulate); install_miniconda(); py_discover_config(); py_install(c('synapseclient', 'pandas'), pip = TRUE, pip_ignore_installed=TRUE)" | ||
|
||
# By default the log level is TRACE. We bump up one level to DEBUG to make the logs a bit less verbose | ||
ENV SHINY_LOG_LEVEL=DEBUG | ||
|
||
# set up r packages via renv. Use binary lib matching the shiny-base ubuntu version | ||
# to speed up installatioon. | ||
RUN Rscript -e 'renv::restore(repos="https://packagemanager.rstudio.com/all/__linux__/jammy/latest"); renv::install("./")' | ||
|
||
# running that script, to pass a configuration env var to Shiny | ||
RUN chmod +x dccvalidator_PEC_startup.sh | ||
CMD ["./dccvalidator_PEC_startup.sh"] |
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
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,11 @@ | ||
#!/usr/bin/bash | ||
|
||
# Pass environment variable to Shiny | ||
echo "" >> .Renviron | ||
echo APP_REDIRECT_URL=$APP_REDIRECT_URL >> .Renviron | ||
echo R_CONFIG_ACTIVE=$R_CONFIG_ACTIVE >> .Renviron | ||
echo client_id=$client_id >> .Renviron | ||
echo client_name=$client_name >> .Renviron | ||
echo client_secret=$client_secret >> .Renviron | ||
# Now run the base start-up script | ||
./startup.sh |
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 |
---|---|---|
|
@@ -151,7 +151,6 @@ amp-ad: | |
contact_email: "[email protected]" | ||
|
||
pec: | ||
app_url: "https://shinypro.synapse.org/users/danlu/dccvalidator/" | ||
parent: "syn21763123" | ||
path_to_markdown: "inst/using-the-dccvalidator-pec.Rmd" | ||
study_table: "syn20968992" | ||
|
Oops, something went wrong.