Skip to content

Commit

Permalink
Add a minimal user container for r2u/bioc2u repos (#1)
Browse files Browse the repository at this point in the history
* Script for apt setup

* Add biocmanager

* Create user.Dockerfile

* Add matrix for builder/user

* Add matrix to merge

* Add type to digest

* Add curl

* Add install bspm and core

* Add ca-certificates
  • Loading branch information
almahmoud authored Sep 29, 2023
1 parent eb15c0f commit 7d1adb7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
26 changes: 14 additions & 12 deletions .github/workflows/build_ghcr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
type: [builder, user]
ubuntu: [focal, jammy]
platform: [linux/amd64]

Expand All @@ -26,7 +27,7 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}-builder
images: ghcr.io/${{ github.repository }}-${{ matrix.type }}
tags: |
type=raw,value=${{ matrix.ubuntu }}
Expand Down Expand Up @@ -59,7 +60,7 @@ jobs:
with:
build-args: |
UBUNTU_TAG=${{matrix.ubuntu}}
file: builder.Dockerfile
file: ${{ matrix.type }}.Dockerfile
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ steps.vars.outputs.container }},push-by-digest=true,name-canonical=true,push=true
platforms: ${{matrix.platform}}
Expand Down Expand Up @@ -98,14 +99,14 @@ jobs:
- name: Export digest by ubuntu and r versions
run: |
digest="${{ steps.build.outputs.digest }}"
mkdir -p /tmp/digests/${{matrix.ubuntu}}
touch "/tmp/digests/${{matrix.ubuntu}}/${digest#sha256:}"
mkdir -p /tmp/digests/${{matrix.ubuntu}}-r-${{steps.versions.outputs.rver}}
touch "/tmp/digests/${{matrix.ubuntu}}-r-${{steps.versions.outputs.rver}}/${digest#sha256:}"
mkdir -p /tmp/digests/${{steps.versions.outputs.osver}}
touch "/tmp/digests/${{steps.versions.outputs.osver}}/${digest#sha256:}"
mkdir -p /tmp/digests/${{steps.versions.outputs.osver}}-r-${{steps.versions.outputs.rver}}
touch "/tmp/digests/${{steps.versions.outputs.osver}}-r-${{steps.versions.outputs.rver}}/${digest#sha256:}"
mkdir -p /tmp/digests/${{matrix.type}}/${{matrix.ubuntu}}
touch "/tmp/digests/${{matrix.type}}/${{matrix.ubuntu}}/${digest#sha256:}"
mkdir -p /tmp/digests/${{matrix.type}}/${{matrix.ubuntu}}-r-${{steps.versions.outputs.rver}}
touch "/tmp/digests/${{matrix.type}}/${{matrix.ubuntu}}-r-${{steps.versions.outputs.rver}}/${digest#sha256:}"
mkdir -p /tmp/digests/${{matrix.type}}/${{steps.versions.outputs.osver}}
touch "/tmp/digests/${{matrix.type}}/${{steps.versions.outputs.osver}}/${digest#sha256:}"
mkdir -p /tmp/digests/${{matrix.type}}/${{steps.versions.outputs.osver}}-r-${{steps.versions.outputs.rver}}
touch "/tmp/digests/${{matrix.type}}/${{steps.versions.outputs.osver}}-r-${{steps.versions.outputs.rver}}/${digest#sha256:}"
- name: Upload digests
uses: actions/upload-artifact@v3
Expand All @@ -124,6 +125,7 @@ jobs:
fail-fast: false
matrix:
ubuntu: [focal, jammy]
type: [builder, user]
steps:
- name: Download digests
uses: actions/download-artifact@v3
Expand All @@ -147,7 +149,7 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}-builder
images: ghcr.io/${{ github.repository }}-${{ matrix.type }}
tags: |
type=raw,value=${{ matrix.ubuntu }}
Expand All @@ -158,6 +160,6 @@ jobs:
- name: Create manifest list and push
run: |
cd /tmp/digests
cd /tmp/digests/${{matrix.type}}
ls --hide=digestdirs > digestdirs
cat digestdirs | xargs -i bash -c 'docker buildx imagetools create -t ${{steps.vars.outputs.container}}:{} $(for f in {}/*; do basename "$f"; done | xargs printf "${{steps.vars.outputs.container}}@sha256:%s ")'
10 changes: 10 additions & 0 deletions apt_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
export UBUNTU_CODENAME=$(grep '^VERSION_CODENAME=' /etc/os-release | cut -d= -f2)
apt update -qq
apt install -y --no-install-recommends curl ca-certificates
curl -O https://raw.githubusercontent.com/eddelbuettel/r2u/master/inst/scripts/add_cranapt_$UBUNTU_CODENAME.sh
bash add_cranapt_$UBUNTU_CODENAME.sh
rm add_cranapt_$UBUNTU_CODENAME.sh
echo "deb [trusted=yes] https://js2.jetstream-cloud.org:8001/swift/v1/bioc2u/ $UBUNTU_CODENAME release" | tee -a /etc/apt/sources.list.d/bioc2u.list > /dev/null
apt update -qq
DEBIAN_FRONTEND=noninteractive apt install -y r-base-core r-cran-biocmanager r-cran-bspm
7 changes: 7 additions & 0 deletions user.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG BASE_IMAGE=ubuntu
ARG UBUNTU_TAG=jammy
FROM ${BASE_IMAGE}:${UBUNTU_TAG} AS base

USER root
COPY apt_setup.sh /bioc_scripts/apt_setup.sh
RUN bash /bioc_scripts/apt_setup.sh

0 comments on commit 7d1adb7

Please sign in to comment.