From e1e86913fab9a87705539bf2baf59a63cee35ba8 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Thu, 28 Dec 2023 14:44:28 -0500 Subject: [PATCH 1/8] feat: create Dockerfile --- Dockerfile | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4a69b1e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,96 @@ +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 \ + 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 \ + 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 devtools +RUN mamba install -c conda-forge r-base=4.3.2 r-devtools + +# install R package +COPY . /opt2/reneeTools +RUN R -e 'devtools::install("/opt2/reneeTools")' + +# cleanup +RUN apt-get clean && apt-get purge && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +COPY Dockerfile /opt2/Dockerfile +RUN chmod -R a+rX /opt2/Dockerfile + +WORKDIR /data2 From 2641ef09cd99e312ffd89141e09295ec3f2616f3 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Thu, 28 Dec 2023 15:04:18 -0500 Subject: [PATCH 2/8] chore: ignore Dockerfile in R build --- .Rbuildignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.Rbuildignore b/.Rbuildignore index 923b852..360db7d 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -10,3 +10,4 @@ ^\.prettierignore$ ^\.prettierrc$ ^data-raw$ +^Dockerfile$ From cdf6cce79c3067ca8da86978b2c5772b68907df9 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Thu, 28 Dec 2023 15:04:43 -0500 Subject: [PATCH 3/8] ci: create action to build docker container & push on release --- .github/workflows/docker.yml | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..69cd817 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,57 @@ +name: docker + +on: + # push: + # paths: + # - '.github/workflows/r-pkg-docker.yml' + # - 'Description' + # - 'Dockerfile' + workflow_dispatch: + release: + types: [published] + +env: + IMAGE_NAME: "reneeTools" + CONTEXT: "./" + NAMESPACE: "nciccbr" + +jobs: + build-docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Prepare build-time variables + id: vars + run: | + echo "DATE=$(date +"%Y-%m-%d")" >> "$GITHUB_OUTPUT" + + if [ '${{ github.event_name }}' == 'release' ]; then + VERSION=${{ github.ref_name }} + else + HASH=$(echo "${{ github.sha }}" | cut -c1-7) + VERSION="$(grep 'Version:' $CONTEXT/DESCRIPTION | sed 's/Version: //')_$HASH" + fi + echo "VERSION_TAG=$(echo $VERSION)" >> "$GITHUB_OUTPUT" + - name: debug + run: | + echo "the github tag is ${{ github.ref_name }}" + echo "github event_name is ${{ github.event_name }}" + echo "the version tag is ${{ steps.vars.outputs.VERSION_TAG }}" + + - 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 + with: + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ env.NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.VERSION_TAG }} + context: ${{ env.CONTEXT }} + file: ${{ env.CONTEXT }}/Dockerfile + build-args: | + BUILD_DATE=${{ steps.vars.outputs.DATE }} + BUILD_TAG=${{ steps.vars.outputs.VERSION_TAG }} + REPONAME=${{ env.IMAGE_NAME }} From 615228f5da0d14f77fd28c8e2b7bf26549a2bfb2 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Thu, 28 Dec 2023 15:07:03 -0500 Subject: [PATCH 4/8] ci: test the docker build in PRs --- .github/workflows/docker.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 69cd817..fa87a89 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,11 +1,11 @@ name: docker on: - # push: - # paths: - # - '.github/workflows/r-pkg-docker.yml' - # - 'Description' - # - 'Dockerfile' + push: + paths: + - ".github/workflows/r-pkg-docker.yml" + - "Description" + - "Dockerfile" workflow_dispatch: release: types: [published] From 0039a3541df91eebf17f47bd6c60b3bea409e34e Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Thu, 28 Dec 2023 15:09:22 -0500 Subject: [PATCH 5/8] ci: fix path to docker action --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index fa87a89..d376d24 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -3,7 +3,7 @@ name: docker on: push: paths: - - ".github/workflows/r-pkg-docker.yml" + - ".github/workflows/docker.yml" - "Description" - "Dockerfile" workflow_dispatch: From 317249be380e40e28362c89781ae0a65d69a9f7f Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Thu, 28 Dec 2023 15:12:35 -0500 Subject: [PATCH 6/8] fix: dockerhub requires lowercase image names --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d376d24..574adc7 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -11,7 +11,7 @@ on: types: [published] env: - IMAGE_NAME: "reneeTools" + IMAGE_NAME: "reneetools" CONTEXT: "./" NAMESPACE: "nciccbr" From d67432716062eca0845f54f49b6bb3ccb67d40b7 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Thu, 28 Dec 2023 17:31:22 -0500 Subject: [PATCH 7/8] fix: need biocViews in description for bioconductor packages --- DESCRIPTION | 1 + 1 file changed, 1 insertion(+) diff --git a/DESCRIPTION b/DESCRIPTION index 1798a6e..40c34ff 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -23,6 +23,7 @@ Imports: Suggests: readr, testthat (>= 3.0.0) +biocViews: Config/testthat/edition: 3 Encoding: UTF-8 LazyData: true From 9e8f00347f8a14b61da6b480dc77ae9bf42a3333 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Thu, 28 Dec 2023 17:46:07 -0500 Subject: [PATCH 8/8] ci: build docker on release or manual dispatch --- .github/workflows/docker.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 574adc7..0d16270 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,11 +1,11 @@ name: docker on: - push: - paths: - - ".github/workflows/docker.yml" - - "Description" - - "Dockerfile" + # push: + # paths: + # - ".github/workflows/docker.yml" + # - "DESCRIPTION" + # - "Dockerfile" workflow_dispatch: release: types: [published]