diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml deleted file mode 100644 index 77491cb..0000000 --- a/.github/workflows/docker-build.yml +++ /dev/null @@ -1,79 +0,0 @@ -# Candace Savonen Apr 2021 - -name: Build Docker - -on: - workflow_dispatch: - inputs: - dockerhubpush: - description: 'Push to Dockerhub?' - required: true - default: 'false' - tag: - description: 'What tag to use?' - required: true - default: 'none' -jobs: - build-docker: - name: Build Docker image - runs-on: ubuntu-latest - - steps: - - name: checkout repo - uses: actions/checkout@v3 - - - name: Login as jhudsl-robot - run: | - git config --system --add safe.directory "$GITHUB_WORKSPACE" - git config --local user.email "itcrtrainingnetwork@gmail.com" - git config --local user.name "jhudsl-robot" - - - name: Don't re-test if this is a sync branch - run: | - echo This was tested on OTTR_Template no need to re-run - - # Set up Docker build - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - # Setup layer cache - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - # Set up Docker build - - name: Set up Docker Build - if: ${{ github.head_ref != 'repo-sync/OTTR_Template/default' }} - uses: docker/setup-buildx-action@v1 - - - name: Get token - run: echo ${{ secrets.GH_PAT }} > docker/git_token.txt - - # Build docker image - - name: Build Docker image - uses: docker/build-push-action@v2 - with: - push: false - load: true - context: docker - file: docker/Dockerfile - tags: jhudsl/base_ottr - - # Login to Dockerhub - - name: Login to DockerHub - if: ${{ github.event.inputs.dockerhubpush != 'false' }} - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - # Push the Docker image if set to true from a manual trigger - - name: Push Docker image if manual trigger set to true - if: ${{ github.event.inputs.dockerhubpush != 'false' }} - run: | - docker tag jhudsl/base_ottr:latest jhudsl/base_ottr:$github.event.inputs.tag - docker push jhudsl/base_ottr:$github.event.inputs.tag diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml deleted file mode 100644 index e1eab59..0000000 --- a/.github/workflows/docker-test.yml +++ /dev/null @@ -1,91 +0,0 @@ - -# Candace Savonen Apr 2022 - -name: Build Docker Image - -on: - workflow_dispatch: - inputs: - directory: - required: true - type: string - tag: - required: true - type: string - dockerhubpush: - description: 'Push to Dockerhub?' - required: false - default: 'false' - type: string - secrets: - GH_PAT: - required: true - DOCKERHUB_USERNAME: - required: false - DOCKERHUB_TOKEN: - required: false - -jobs: - - build-docker: - name: Build Docker image - runs-on: ubuntu-latest - - steps: - - name: checkout repo - uses: actions/checkout@v3 - - - name: Verify Dockerfiles changed? - uses: tj-actions/verify-changed-files@v8.8 - id: verify-changed-files - with: - files: | - ${{ inputs.directory }}/Dockerfile - ${{ inputs.directory }}/github_package_list.tsv - - - name: Login as jhudsl-robot - run: | - git config --system --add safe.directory "$GITHUB_WORKSPACE" - git config --local user.email "itcrtrainingnetwork@gmail.com" - git config --local user.name "jhudsl-robot" - - # Set up Docker build - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - # Setup layer cache - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - - name: Set up Docker Build - uses: docker/setup-buildx-action@v1 - - - name: Get token - run: echo ${{ secrets.GH_PAT }} > ${{ inputs.directory }}/git_token.txt - - - name: Build Docker image - uses: docker/build-push-action@v2 - with: - push: false - load: true - context: ${{ inputs.directory }} - file: ${{ inputs.directory }}/Dockerfile - tags: ${{ inputs.tag }} - - # Login to Dockerhub - - name: Login to DockerHub - if: ${{ inputs.dockerhubpush != 'false' }} - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - # Push the Docker image if set to true from a manual trigger - - name: Push Docker image if manual trigger set to true - if: ${{ inputs.dockerhubpush != 'false' }} - run: docker push ${{ inputs.tag }} diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 1c0c6e0..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,78 +0,0 @@ -FROM rocker/tidyverse:4.0.2 -LABEL maintainer="cansav09@gmail.com" -WORKDIR /rocker-build/ - -COPY install_github.R . - -# Install apt-getable packages to start -RUN apt-get update && apt-get install -y --no-install-recommends apt-utils dialog -RUN apt-get install -y --no-install-recommends \ - libxt6 \ - libpoppler-cpp-dev \ - vim \ - libglpk40 \ - curl \ - gpg - -# Install gh -RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg; -RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null; -RUN apt update && apt install -y gh; - -# Remove old symlinks to old pandoc -RUN unlink /usr/lib/rstudio-server/bin/pandoc/pandoc - -# Uninstall old version of pandoc -RUN sudo apt-get purge pandoc pandoc-citeproc pandoc-data \ - && sudo apt-get autoremove --purge - -# Install pandoc -RUN wget https://github.com/jgm/pandoc/releases/download/2.14.1/pandoc-2.14.1-1-amd64.deb \ - && sudo apt-get install ./pandoc-2.14.1-1-amd64.deb - -# Create new symlinks -RUN ln -s /usr/bin/pandoc /usr/lib/rstudio-server/bin/pandoc/pandoc - -# Add curl, bzip2 -RUN apt-get update -qq && apt-get -y --no-install-recommends install \ - bzip2 \ - curl - -# Install pip3 and installation tools -RUN apt-get -y --no-install-recommends install \ - python3-pip python3-dev - -# Commonly used R packages -RUN Rscript -e "options(warn = 2);install.packages( \ - c('bookdown', \ - 'here', \ - 'leanpubr', \ - 'optparse', \ - 'oro.nifti', \ - 'qpdf', \ - 'R.utils', \ - 'rprojroot', \ - 'rgoogleslides', \ - 'servr', \ - 'spelling', \ - 'styler', \ - 'reticulate'), \ - repos = 'https://cloud.r-project.org/')" - -# cow needs this dependency: -RUN Rscript -e "devtools::install_version('gitcreds', version = '0.1.1', repos = 'http://cran.us.r-project.org')" - -# Didactr needs this dependency: -RUN Rscript -e "devtools::install_version('lifecycle', version = '1.0.0', repos = 'http://cran.us.r-project.org')" - -# Copy over git token and package list -COPY git_token.txt . -COPY github_package_list.tsv . - -# Install packages from github -RUN Rscript install_github.R \ - --packages github_package_list.tsv \ - --token git_token.txt - -# Set final workdir for commands -WORKDIR /home/rstudio diff --git a/docker/Dockerfile_ottrpal b/docker/Dockerfile_ottrpal deleted file mode 100644 index 692e5b7..0000000 --- a/docker/Dockerfile_ottrpal +++ /dev/null @@ -1,29 +0,0 @@ -FROM jhudsl/course_template:main -LABEL maintainer="cansav09@gmail.com" - -# Install apt-getable packages to start -RUN apt-get update && apt-get install -y --no-install-recommends apt-utils dialog - -RUN apt-get install -y --no-install-recommends \ - libxt6 \ - libpoppler-cpp-dev \ - vim \ - libglpk40 \ - curl \ - gpg - -# Install R -RUN apt-get update && apt-get install -y r-base curl - -# Install R packages -RUN Rscript -e "install.packages('curl')" - -# Install phantomjs -RUN apt-get update && apt-get install build-essential chrpath libssl-dev libxft-dev -y \ - && apt-get install libfontconfig1 libfontconfig1-dev -y \ - && cd ~ && export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64" \ - && wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2 \ - && sudo tar xvjf $PHANTOM_JS.tar.bz2 \ - && sudo mv $PHANTOM_JS /usr/local/share \ - && sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin \ - && phantomjs --version diff --git a/docker/github_package_list.tsv b/docker/github_package_list.tsv deleted file mode 100644 index e587cda..0000000 --- a/docker/github_package_list.tsv +++ /dev/null @@ -1,10 +0,0 @@ -rstudio/rmarkdown 02d3c2512686fda9c14c2a0e300aa02525f16ca5 -yihui/xfun 74c2a6605d8f0fb19314da542baeead6dc8697d9 -yihui/knitr a1052d12e0ff8f4ead365b4c85ef5835faa1c492 -r-lib/rlang f0c9be5c5806b4e4b120b7516f286fef3c66bda5 -jhudsl/didactr cde4598c10f2b5e2e31b47fe94ca1b02db420e10 -jhudsl/ottrpal HEAD -tidyverse/rvest 4fe39fb5089512d77b6a9cc026e5c895258ff6ce -R-lib/testthat e99155af85261e065192feb946dcfa6679cffae4 -rstudio/bookdown 88bc4ead8562ea281838041c795b38fc4a6a7165 -jhudsl/cow HEAD \ No newline at end of file diff --git a/docker/install_github.R b/docker/install_github.R deleted file mode 100644 index fb532ec..0000000 --- a/docker/install_github.R +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env Rscript - -if (!"optparse" %in% installed.packages()) { - install.packages("optparse") -} - -library(optparse) - -################################ Set up options ################################ -# Set up optparse options -option_list <- list( - make_option( - opt_str = c("-p", "--packages"), type = "character", - default = "github_package_list.tsv" , - help = "Path to a TSV with a list of packages to be installed through Github, - where file where the first column is the github package name e.g. - jhudsl/ottrpal and the second column is the commit ID to be installed - (to be supplied to the ref argument). - ", - metavar = "character" - ), - make_option( - opt_str = c("--token"), type = "character", - default = NULL, - help = "GITHUB PAT file", - metavar = "character" - ) -) - -# Parse options -opt <- parse_args(OptionParser(option_list = option_list)) - -# Read in the token -token <- as.character(readLines(opt$token)[1]) - -# Reset GITHUB PAT to be token -Sys.unsetenv("GITHUB_PAT") -Sys.setenv(GITHUB_PAT = token) - -# set up list of packages to install -packages <- readr::read_tsv(opt$packages, - col_names = c("package_name", "ref")) - -purrr::pmap( - packages, - ~remotes::install_github(..1, - auth_token = token, - ref = ..2) - ) - -# Remove the file after we are done -file.remove(opt$token)