Skip to content

Should we add a 'base' build container so we have a technology agnostic foundation? #26

@grayside

Description

@grayside

I've been thinking about how we present Outrigger as a technology-agnostic solution, but our build container isn't all that agnostic. It's a big pile of stuff which is aimed at the tools and tech stacks Phase2 tends to work with around PHP & Drupal.

What if we centralized the truly tech-agnostic stuff we want in a build container for any application into a "base", then extend that into others? I've put together a bit of a demonstration in the expando-matic sections below.

Base Dockerfile
FROM centos:7

# Install base packages.
RUN yum -y install epel-release yum-plugin-ovl deltarpm && \
  # Add the IUS repository. This is needed for git2.
  curl -L "https://centos7.iuscommunity.org/ius-release.rpm" > /usr/local/ius-release.rpm && \
  rpm -Uvh /usr/local/ius-release.rpm
  yum -y update && \
  yum -y install \
    bzip2 \
    curl \
    dnsutils \
    git2u-all \
    jq \
    less \
    make \
    openssl \
    patch \
    pv \
    rsync \
    sudo \
    ssh \
    sendmail \
    unzip \
    vim-minimal \
    # Necessary for drush and developer orientation.
    which \
  yum clean all

# Download & Install confd.
ENV CONFD_VERSION 0.11.0
RUN curl -L "https://github.com/kelseyhightower/confd/releases/download/v$CONFD_VERSION/confd-$CONFD_VERSION-linux-amd64" > /usr/bin/confd && \
    chmod +x /usr/bin/confd
ENV CONFD_OPTS '--backend=env --onetime'

# Ensure $HOME is set
ENV HOME /root

# Configure Git
# https://git-scm.com/docs/git-config#git-config-corepreloadIndex
RUN git config --global core.preloadindex true

# Run the s6-based init.
ENTRYPOINT ["/init"]

# Set up a standard volume for logs.
VOLUME ["/var/log/services"]

COPY root /

CMD [ "/versions.sh" ]
Extending php7.0 Dockerfile
FROM outrigger/build-base

RUN yum -y install centos-release-scl && \
  yum-config-manager --enable rhel-server-rhscl-7-rpms && \
  yum -y update && \
  yum -y install \
    https://rpms.remirepo.net/enterprise/remi-release-7.rpm \
    gcc-c++ \
    httpd-tools \
    mariadb \
    nmap-ncat \
    php70 \
    php70-php-devel \
    php70-php-gd \
    php70-php-xml \
    php70-php-pdo \
    php70-php-mysql \
    php70-php-mysqlnd \
    php70-php-mbstring \
    php70-php-fpm \
    php70-php-opcache \
    php70-php-pecl-memcache \
    php70-php-pecl-xdebug \
    php70-php-posix \
    php70-php-mcrypt \
    postgresql \
    ruby193 \
    ruby193-rubygems \
    ruby193-ruby-devel \
    # Necessary library for phantomjs per https://github.com/ariya/phantomjs/issues/10904
    fontconfig && \
    yum clean all

# Also the composer, ruby, node, and drush things.
Pros Cons
Easy starting place for new build images Another image to manage
Have leaner build image by application stack Steer towards an explosive number of build images (Node app vs. PHP app have different build containers, instead of one build container with all for both)
Clarify our core definition of a build container Confuse people whether a change belongs in base, all images for a given language, or a specific build image language version

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions