Skip to content

Commit

Permalink
Merge pull request #36 from CCBR/report
Browse files Browse the repository at this point in the history
spacesavers2 report
  • Loading branch information
kopardev authored Oct 26, 2023
2 parents 72b08f6 + fff3ca6 commit 3ca8663
Show file tree
Hide file tree
Showing 13 changed files with 6,257 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs/*.html linguist-generated
57 changes: 57 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: docker

on:
push:
paths:
- .github/workflows/docker.yml
- "docker/**"
workflow_dispatch:

jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix-metadata: ${{ steps.metadata.outputs.matrix }}
steps:
- uses: hellofresh/action-changed-files@v3
id: metadata
with:
pattern: docker/(?P<image_dir>\w+)/.*
default-patterns: |
meta.yml
Dockerfile
update-docker:
needs: [generate-matrix]
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix-metadata) }}
if: ${{ fromJson(needs.generate-matrix.outputs.matrix-metadata).include[0] }} # skip if the matrix is empty!
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pietrobolcato/[email protected]
id: metadata
with:
config: ${{ github.workspace }}/docker/${{ matrix.image_dir }}/meta.yml
- name: Get date
id: date
run: |
echo "DATE=$(date +"%Y-%m-%d")" >> $GITHUB_OUTPUT
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
# only try building & pushing the container if parsing the metadata worked
if: ${{ steps.metadata.outputs['container'] != '' }}
with:
context: docker/${{ matrix.image_dir }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.metadata.outputs['container'] }}
build-args: |
BUILD_DATE=${{ steps.date.outputs.DATE }}
BUILD_TAG=${{ steps.metadata.outputs['version'] }}
REPONAME=${{ steps.metadata.outputs['image_name'] }}
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
**/.koparde*
**/.kopard*
**/.DS_Store
**/__pycache__
**/.**.swp
**/slurm-*

# mkdocs documentation
/site
**/test.py
**/test/

# data
/data/

# R
.Rproj.user
*.Rproj
.Rhistory
/.quarto/
12 changes: 11 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
default_install_hook_types: [pre-commit, commit-msg]
default_stages: [pre-commit]
exclude: |
(?x)(
^assets/|
^docs/.*.html
)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.2.3
hooks:
- id: check-added-large-files
#- id: check-yaml
args: ['--maxkb=50000']
- id: end-of-file-fixer
- id: trailing-whitespace
# spell check
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
# https://github.com/codespell-project/codespell/issues/1498
# Python formatting
- repo: https://github.com/psf/black
rev: 23.7.0
Expand All @@ -31,3 +39,5 @@ repos:
rev: v2.3.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: []
17 changes: 17 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
**/.koparde*
**/.DS_Store
**/__pycache__
**/.**.swp
**/slurm-*

# mkdocs documentation
/site
**/test.py
**/test/

# data
/data/

# R
.Rproj.user
*.Rproj
5 changes: 5 additions & 0 deletions bin/render.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env Rscript
rmarkdown::render("report.Rmd",
output_file = "docs/report.html",
params = list(input_dir = "data")
)
9 changes: 9 additions & 0 deletions bin/render_report_biowulf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# to be executed from /data/CCBR_Pipeliner/Tools/spacesavers2/report
# Usage: bash bin/render_report_biowulf.sh
module load singularity
SINGULARITY_CACHEDIR=/data/CCBR_Pipeliner/SIFS
echo "cd /mnt && Rscript bin/render.R" |\
singularity exec -C -B $PWD:/mnt,/data/CCBR_Pipeliner/userdata/spacesavers2/:/mnt/data docker://nciccbr/spacesavers2:0.1.1 bash
today=$(date +'%Y-%m-%d')
cp docs/report.html docs/report_${today}.html
105 changes: 105 additions & 0 deletions docker/spacesavers2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
FROM ubuntu:20.04

# build time variables
ARG BUILD_DATE="000000"
ENV BUILD_DATE=${BUILD_DATE}
ARG BUILD_TAG="000000"
ENV BUILD_TAG=${BUILD_TAG}
ARG REPONAME="000000"
ENV REPONAME=${REPONAME}

RUN mkdir -p /opt2 && mkdir -p /data2
ENV TZ=America/New_York
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apt update && apt-get -y upgrade
# Set the locale
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
locales build-essential cmake cpanminus && \
localedef -i en_US -f UTF-8 en_US.UTF-8 && \
cpanm FindBin Term::ReadLine

# install basic dependencies with apt-get
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
figlet \
g++ \
gcc \
gfortran \
git \
libatlas-base-dev \
libblas-dev \
libboost-dev \
libbz2-dev \
libcurl4-openssl-dev \
libexpat1-dev \
libfreetype6-dev \
libgd-dev \
libgd-perl \
libglib2.0-dev \
libgpgme11-dev \
libgs-dev \
libgsl-dev \
libgsl0-dev \
libhtml-template-compiled-perl \
libicu-dev \
libjudy-dev \
liblapack-dev \
liblzma-dev \
libmysqlclient-dev \
libncurses-dev \
libopenmpi-dev \
libpng-dev \
librtmp-dev \
libseccomp-dev \
libssl-dev \
libtool \
libxml-libxml-debugging-perl \
libxml-opml-simplegen-perl \
libxml2-dev \
libxslt-dev \
make \
manpages-dev \
openjdk-17-jre-headless \
parallel \
pigz \
pkg-config \
python3-pip \
python3-dev \
rsync \
squashfs-tools \
unzip \
uuid-dev \
wget \
zlib1g \
zlib1g-dev \
zlibc

# Install conda and give write permissions to conda folder
RUN echo 'export PATH=/opt2/conda/bin:$PATH' > /etc/profile.d/conda.sh && \
wget --quiet "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" -O ~/miniforge3.sh && \
/bin/bash ~/miniforge3.sh -b -p /opt2/conda && \
rm ~/miniforge3.sh && chmod 777 -R /opt2/conda/
ENV PATH="/opt2/conda/bin:$PATH"

# install pandoc & R packages
COPY environment.txt /data2/
RUN mamba install -c conda-forge --file /data2/environment.txt
ENV R_LIBS_USER=/opt2/conda/lib/R/library/

# install quarto
ENV QUARTO_VERSION="1.3.450"
ADD https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.tar.gz /opt2
WORKDIR /opt2
RUN tar -xzvf quarto-${QUARTO_VERSION}-linux-amd64.tar.gz
ENV PATH="/opt2/quarto-${QUARTO_VERSION}/bin/:${PATH}"
RUN quarto check

# Save Dockerfile in the docker
COPY Dockerfile /opt2/Dockerfile_${REPONAME}.${BUILD_TAG}
RUN chmod a+r /opt2/Dockerfile_${REPONAME}.${BUILD_TAG}

# cleanup
WORKDIR /data2
RUN apt-get clean && apt-get purge \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
26 changes: 26 additions & 0 deletions docker/spacesavers2/environment.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
pandoc
r-base=4.3.1
r-DT
r-RColorBrewer
r-bslib=0.5.1
r-crosstalk
r-downlit
r-dplyr
r-fontawesome
r-ggplot2
r-glue
r-here
r-janitor
r-knitr
r-lubridate
r-plotly
r-purrr
r-readr
r-rlang
r-rmarkdown
r-scales
r-shiny
r-stringr
r-tibble
r-tidyr
r-xml2
4 changes: 4 additions & 0 deletions docker/spacesavers2/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dockerhub_namespace: nciccbr
image_name: spacesavers2
version: 0.1.1
container: "$(dockerhub_namespace)/$(image_name):$(version)"
5,538 changes: 5,538 additions & 0 deletions docs/report.html

Large diffs are not rendered by default.

Loading

0 comments on commit 3ca8663

Please sign in to comment.