diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..e6e3f34 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,89 @@ +name: Docker + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +on: + schedule: + - cron: '32 5 * * *' + push: + branches: [ "main" ] + # Publish semver tags as releases. + tags: [ 'v*.*.*' ] + pull_request: + branches: [ "main" ] + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Install the cosign tool except on PR + - name: Install cosign + if: github.event_name != 'pull_request' + uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0 + with: + cosign-release: 'v2.2.4' + + # Set up BuildKit Docker container builder + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 + + # Login against a Docker registry except on PR + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Lowercase repo variable + - name: Downcase REPO variable + run: | + echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} + + # Extract metadata (tags, labels) for Docker + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build and push Docker image with Buildx + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + # Sign the resulting Docker image digest + - name: Sign the published Docker image + if: ${{ github.event_name != 'pull_request' }} + env: + TAGS: ${{ steps.meta.outputs.tags }} + DIGEST: ${{ steps.build-and-push.outputs.digest }} + run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1dc0273 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,53 @@ +FROM rocker/r-ver:4.5.2 + +# System dependencies +RUN apt-get update -y && apt-get install -y \ + make \ + pkg-config \ + libpcre2-dev \ + libbz2-dev \ + liblzma-dev \ + libicu-dev \ + libcurl4-openssl-dev \ + libfftw3-dev \ + pandoc \ + zlib1g-dev \ + libjpeg-dev \ + libpng-dev \ + default-jdk \ + libtiff-dev \ + && rm -rf /var/lib/apt/lists/* + +# rJava configuration +RUN R CMD javareconf + +# R and renv setup +RUN mkdir -p /usr/local/lib/R/etc/ /usr/lib/R/etc/ + +# Change to workdir +WORKDIR /srv/shiny-server/ + +# Copy renv +COPY Shiny/renv /srv/shiny-server/renv +COPY Shiny/.Rprofile /srv/shiny-server/.Rprofile +COPY Shiny/renv.lock /srv/shiny-server/renv.lock + +# Env configuration +ENV RENV_PATHS_CACHE=/root/.cache/R/renv +ENV RENV_CONFIG_CACHE_SYMLINKS=false +ENV HOME=/home/ + +# Run renv::restore() +RUN R -e 'source("renv/activate.R")' +RUN --mount=type=cache,id=renv-cache,target=/root/.cache/R/renv R -e 'renv::restore()' + +# Copy Shiny app +COPY Shiny/ij /srv/shiny-server/ij +COPY Shiny/www /srv/shiny-server/www +COPY Shiny/app.R /srv/shiny-server/app.R +COPY Shiny/Functions.R /srv/shiny-server/Functions.R +COPY Example_images/ /srv/Example_images/ + +# Expose and run +EXPOSE 3838 +CMD ["R", "-e", "shiny::runApp('/srv/shiny-server', host='0.0.0.0', port=3838)"] \ No newline at end of file diff --git a/Shiny/app.R b/Shiny/app.R index 4ecc244..cc96b14 100644 --- a/Shiny/app.R +++ b/Shiny/app.R @@ -37,7 +37,7 @@ ui <- fluidPage( align = "rigth", height = 80 ), - href = "https://github.com/antotartier/FAB-gal", + href = "https://github.com/GenCanAgeLab/FAB-gal", target = "_blank" ) ), @@ -222,7 +222,7 @@ ui <- fluidPage( actionButton('run.all', "Run for all images", class = "btn-primary"), a( "Click Here To Learn More", - href = "https://github.com/antotartier/FAB-gal/wiki", + href = "https://github.com/GenCanAgeLab/FAB-gal/wiki", target = "_blank", class = "btn btn-info", icon = icon("info-circle") @@ -312,7 +312,7 @@ ui <- fluidPage( ), a( "github.com/GenCanAgeLab/SAbGal_quant", - href = "https://github.com/antotartier/FAB-gal", + href = "https://github.com/GenCanAgeLab/FAB-gal", target = "_blank" ) ),