-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
120 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,55 @@ | ||
name: Docker Shiny App | ||
|
||
on: | ||
push: | ||
# Publish `main` as Docker `latest` image. | ||
branches: | ||
- main | ||
|
||
# Publish `v1.2.3` tags as releases. | ||
tags: | ||
- v* | ||
|
||
env: | ||
IMAGE_NAME: airspec-app | ||
|
||
jobs: | ||
# Push image to GitHub Packages. | ||
# See also https://docs.docker.com/docker-hub/builds/ | ||
push: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
lfs: true | ||
|
||
- name: Build image | ||
run: docker build backend --tag $IMAGE_NAME | ||
|
||
- name: Log into registry | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Push image | ||
run: | | ||
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME | ||
# Change all uppercase to lowercase | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
# Strip git ref prefix from version | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
# Strip "v" prefix from tag name | ||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | ||
# Use Docker `latest` tag convention | ||
[ "$VERSION" == "main" ] && VERSION=latest | ||
echo IMAGE_ID=$IMAGE_ID | ||
echo VERSION=$VERSION | ||
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | ||
docker push $IMAGE_ID:$VERSION |
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,26 @@ | ||
# Use the R Shiny base image | ||
FROM rocker/shiny:latest | ||
|
||
# Install R packages | ||
COPY R/install.R /srv | ||
RUN Rscript /srv/install.R | ||
|
||
# Copy your app into the container | ||
COPY R/app.R /srv/shiny-server/ | ||
|
||
# Create a new user | ||
RUN useradd -m -u 1000 shiny_user \ | ||
&& chown -R shiny_user:shiny_user /srv/shiny-server | ||
|
||
# Set proper permissions | ||
RUN chown -R shiny_user:shiny_user /usr/local/lib/R/site-library/AIRSpec/ShinyApp/ | ||
|
||
# Switch to non-root user | ||
USER shiny_user | ||
|
||
# Make the app available at port 3838 | ||
EXPOSE 3838 | ||
|
||
# Run the app | ||
#CMD ["/usr/bin/shiny-server"] | ||
CMD ["Rscript", "/srv/shiny-server/app.R"] |
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,5 @@ | ||
build: | ||
docker build --pull --no-cache=false -t airspec-app . | ||
|
||
run: | ||
docker run -p 3838:3838 airspec-app |
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,6 @@ | ||
library(shiny) | ||
library(methods) | ||
library(AIRSpec) | ||
|
||
AIRSPECDir <- "/usr/local/lib/R/site-library/AIRSpec/ShinyApp/" | ||
runApp(appDir = AIRSPECDir, host = "0.0.0.0", port = 3838) |
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,23 @@ | ||
#pkglist <- c("AIRSpec", "Rfunctools", "APRLspec", "APRLmpf", "APRLmvr", "APRLssb") | ||
# pkglist <- c("AIRSpec", "APRLspec", "APRLmpf", "APRLmvr", "APRLssb") | ||
# | ||
# for (pkg in pkglist) { | ||
# print(paste("Installing package:", pkg, "...")) | ||
# remotes::install_gitlab(sprintf('aprl/%s', pkg), dependencies = TRUE) | ||
# } | ||
|
||
extras <- c("RSQLite", "RJSONIO", "tidyverse", "shinythemes", "purrr", "shiny", "pls", "grDevices", "envDocument", "reshape2", "pryr", "Hmisc", "quantreg", "abind", "remotes") | ||
for (p in extras) { | ||
install.packages(p) | ||
} | ||
|
||
url <- "https://www.dropbox.com/scl/fo/zcvv8xhvjg1wgad6gwep2/ABJGNldXXWS1z_w0_IuNHxk?rlkey=ch45dvbwcmohu6csa3eqxonn0&e=2&dl=1" | ||
destzip <- file.path(tempdir(), "AIRSpec_packages.zip") | ||
download.file(url, destzip) | ||
destfolder <- file.path(tempdir(), "AIRSpec_packages") | ||
unzip(destzip, exdir = destfolder) | ||
|
||
pkglist <- c("AIRSpec", "Rfunctools", "APRLspec", "APRLmpf", "APRLmvr", "APRLssb") | ||
for (pkg in pkglist) { | ||
remotes::install_local(file.path(destfolder, pkg), dependencies = TRUE, force = TRUE) | ||
} |
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,5 @@ | ||
# AIRSpec | ||
|
||
R Shiny app exposing Tools for Aerosol InfraRed Spectroscopy. | ||
|
||
See [https://airspec.epfl.ch](https://airspec.epfl.ch). |