Skip to content

Commit

Permalink
initial commit (carried over from rocker-org/rocker/r-ubuntu)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddelbuettel committed Sep 28, 2021
0 parents commit 8256538
Show file tree
Hide file tree
Showing 4 changed files with 187 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: docker

on:
push:
schedule:
- cron: "22 3 25 * *"

jobs:
docker:
runs-on: ubuntu-latest
name: ${{ matrix.tag }}

strategy:
fail-fast: false
matrix:
config:
- { directory: bionic, tag: '18.04' }
- { directory: focal, tag: '20.04' }

steps:
- name: Checkout
uses: actions/checkout@v2

#- name: Set up QEMU
# uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: ${{ matrix.config.directory }}
tags: rocker/r-ubuntu:${{ matrix.config.tag }}
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

r-ubuntu -- 'r-base' for Ubuntu LTS
===================================

This Dockerfile is close to the ['r-base'](https://github.com/rocker-org/rocker/tree/master/r-base) container
for Rocker -- which is the same container as the official ['r-base'](https://hub.docker.com/_/r-base) container for R -- but based on
Ubuntu LTS. And while 'r-base' uses Debian testing, this container is based on
the LTS release and connects to the [PPA by Michael Rutter](https://launchpad.net/~marutter/+archive/ubuntu/c2d4u3.5) with over
4,000 r-cran-* packages.

To install, use the explicit LTS tag---currently 18.04---when pulling

```
docker pull r-ubuntu:18.04
```

as we do not want to use latest (which may suggest an interim Ubuntu release
between the bi-annual LTS schedule).

As always, this is work in progress -- please come and talk to @eddelbuettel and
@cboettig (via GitHub issue tickets) about how to get involved.

Documentation is being added at the [Wiki](https://github.com/rocker-org/rocker/wiki).
62 changes: 62 additions & 0 deletions bionic/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
## Emacs, make this -*- mode: sh; -*-

FROM ubuntu:bionic

LABEL org.label-schema.license="GPL-2.0" \
org.label-schema.vcs-url="https://github.com/rocker-org/r-ubuntu" \
org.label-schema.vendor="Rocker Project" \
maintainer="Dirk Eddelbuettel <[email protected]>"

## Set a default user. Available via runtime flag `--user docker`
## Add user to 'staff' group, granting them write privileges to /usr/local/lib/R/site.library
## User should also have & own a home directory (for rstudio or linked volumes to work properly).
RUN useradd docker \
&& mkdir /home/docker \
&& chown docker:docker /home/docker \
&& addgroup docker staff

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
software-properties-common \
dirmngr \
ed \
less \
locales \
vim-tiny \
wget \
ca-certificates \
&& add-apt-repository --enable-source --yes "ppa:marutter/rrutter4.0" \
&& add-apt-repository --enable-source --yes "ppa:c2d4u.team/c2d4u4.0+"

## Configure default locale, see https://github.com/rocker-org/rocker/issues/19
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen en_US.utf8 \
&& /usr/sbin/update-locale LANG=en_US.UTF-8

ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8

## This was not needed before but we need it now
ENV DEBIAN_FRONTEND noninteractive

## Otherwise timedatectl will get called which leads to 'no systemd' inside Docker
ENV TZ UTC

# Now install R and littler, and create a link for littler in /usr/local/bin
# Default CRAN repo is now set by R itself, and littler knows about it too
# r-cran-docopt is not currently in c2d4u so we install from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
littler \
r-base \
r-base-dev \
r-recommended \
&& ln -s /usr/lib/R/site-library/littler/examples/install.r /usr/local/bin/install.r \
&& ln -s /usr/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r \
&& ln -s /usr/lib/R/site-library/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
&& ln -s /usr/lib/R/site-library/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
&& install.r docopt \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
&& rm -rf /var/lib/apt/lists/*

CMD ["bash"]
62 changes: 62 additions & 0 deletions focal/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
## Emacs, make this -*- mode: sh; -*-

FROM ubuntu:focal

LABEL org.label-schema.license="GPL-2.0" \
org.label-schema.vcs-url="https://github.com/rocker-org/r-ubuntu" \
org.label-schema.vendor="Rocker Project" \
maintainer="Dirk Eddelbuettel <[email protected]>"

## Set a default user. Available via runtime flag `--user docker`
## Add user to 'staff' group, granting them write privileges to /usr/local/lib/R/site.library
## User should also have & own a home directory (for rstudio or linked volumes to work properly).
RUN useradd docker \
&& mkdir /home/docker \
&& chown docker:docker /home/docker \
&& addgroup docker staff

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
software-properties-common \
dirmngr \
ed \
less \
locales \
vim-tiny \
wget \
ca-certificates \
&& add-apt-repository --enable-source --yes "ppa:marutter/rrutter4.0" \
&& add-apt-repository --enable-source --yes "ppa:c2d4u.team/c2d4u4.0+"

## Configure default locale, see https://github.com/rocker-org/rocker/issues/19
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen en_US.utf8 \
&& /usr/sbin/update-locale LANG=en_US.UTF-8

ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8

## This was not needed before but we need it now
ENV DEBIAN_FRONTEND noninteractive

## Otherwise timedatectl will get called which leads to 'no systemd' inside Docker
ENV TZ UTC

# Now install R and littler, and create a link for littler in /usr/local/bin
# Default CRAN repo is now set by R itself, and littler knows about it too
# r-cran-docopt is not currently in c2d4u so we install from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
littler \
r-base \
r-base-dev \
r-recommended \
&& ln -s /usr/lib/R/site-library/littler/examples/install.r /usr/local/bin/install.r \
&& ln -s /usr/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r \
&& ln -s /usr/lib/R/site-library/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
&& ln -s /usr/lib/R/site-library/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
&& install.r docopt \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
&& rm -rf /var/lib/apt/lists/*

CMD ["bash"]

0 comments on commit 8256538

Please sign in to comment.