Skip to content

Commit

Permalink
R-based data processing
Browse files Browse the repository at this point in the history
  • Loading branch information
jangevaare committed Apr 22, 2024
1 parent b6d82a0 commit bff8380
Show file tree
Hide file tree
Showing 3 changed files with 460 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/build-processing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build Processing Image

on:
push:
branches:
- main
tags:
- '*'
paths:
- 'processing/**'
pull_request:
branches:
- main
paths:
- 'processing/**'

env:
REGISTRY: ghcr.io

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for processing container
id: meta-processing
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}/processing
flavor: latest=false
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha,prefix=main-
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push processing container image
uses: docker/build-push-action@v5
with:
context: ./processing
file: ./processing/dockerfile
push: true
tags: ${{ steps.meta-processing.outputs.tags }}
31 changes: 31 additions & 0 deletions processing/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM rocker/r-ver:4.3.3

WORKDIR /home/docker/

# Library initialization using renv
RUN Rscript --vanilla -e " \
options(repos = c(CRAN = 'https://cloud.r-project.org')); \
install.packages('renv') \
"

# Direct dependencies
RUN Rscript --vanilla -e " \
renv::install( \
packages = c( \
'dplyr@1.1.4', \
'magrittr@2.0.3', \
'optparse@1.7.5', \
'readr@2.1.5', \
'renv@1.0.7', \
'stringr@1.5.1', \
'tidyr@1.3.1' \
), \
prompt = F, \
lock = T \
) \
"
# Data processing code
COPY process.R /home/docker/

# Run container
ENTRYPOINT ["Rscript", "--vanilla", "process.R"]
Loading

0 comments on commit bff8380

Please sign in to comment.