Skip to content

Instantly share code, notes, and snippets.

@djpadz
Last active February 5, 2020 19:44
Show Gist options
  • Save djpadz/76de4bc166e35536be6204474d578425 to your computer and use it in GitHub Desktop.
Save djpadz/76de4bc166e35536be6204474d578425 to your computer and use it in GitHub Desktop.
Dockerfile to build s6 RPMs under OEL 7
FROM oraclelinux:7-slim
ARG skalibs_version=2.9.1.0
ARG s6_version=2.9.0.1
ARG execline_version=2.5.3.0
ARG ruby_version=2.6
RUN true \
&& yum-config-manager --enablerepo=ol7_optional_latest \
&& yum install -y git gcc make which
# Install rvm and fpm. At some point, this won't be necessary, but I'm too
# lazy to hand-build the RPM defs right now.
RUN true \
&& gpg2 < /dev/null || true \
&& gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB \
&& curl -sSL https://get.rvm.io | bash -s stable \
&& /usr/local/rvm/bin/rvm install ruby-${ruby_version} \
&& /usr/local/rvm/bin/rvm alias create default ${ruby_version} \
&& /usr/local/rvm/bin/rvm default do gem install --no-doc fpm
# fpm needs rpmbuild
RUN yum install -y rpm-build
# Grab the source for the various components from git.skarnet.org.
RUN true \
&& mkdir -p /tmp/pkgs \
&& cd /usr/src \
&& git clone git://git.skarnet.org/skalibs -b v${skalibs_version} \
&& git clone git://git.skarnet.org/execline -b v${execline_version} \
&& git clone git://git.skarnet.org/s6 -b v${s6_version}
# Use the unix time as our iteration.
RUN date +%s > /.iteration
# Build skalibs.
RUN true \
&& cd /usr/src/skalibs \
&& ./configure --dynlibdir=/usr/lib64 \
&& make install DESTDIR=/tmp/skalibs \
&& cd /tmp/pkgs \
&& /usr/local/rvm/bin/rvm default do fpm -s dir -t rpm -n skalibs -v ${skalibs_version} --iteration $(</.iteration) /tmp/skalibs/=/ \
&& rm -rf /tmp/skalibs
RUN yum install -y /tmp/pkgs/skalibs-*.rpm
# Build execline.
RUN true \
&& cd /usr/src/execline \
&& ./configure --dynlibdir=/usr/lib64 --bindir=/usr/libexec/execline \
&& make install DESTDIR=/tmp/execline \
&& cd /tmp/pkgs \
&& /usr/local/rvm/bin/rvm default do fpm -s dir -t rpm -n execline -v ${execline_version} --iteration $(</.iteration) --rpm-tag "Requires: skalibs = ${skalibs_version}" /tmp/execline/=/ \
&& rm -rf /tmp/execline
RUN yum install -y /tmp/pkgs/execline-*.rpm
# Build s6
RUN true \
&& cd /usr/src/s6 \
&& ./configure --dynlibdir=/usr/lib64 --with-lib=/usr/lib/execline \
&& make install DESTDIR=/tmp/s6 \
&& cd /tmp/pkgs \
&& /usr/local/rvm/bin/rvm default do fpm -s dir -t rpm -n s6 -v ${s6_version} --iteration $(</.iteration) --rpm-tag "Requires: skalibs = ${skalibs_version}" --rpm-tag "Requires: execline = ${execline_version}" /tmp/s6/=/ \
&& rm -rf /tmp/execline
RUN yum install -y /tmp/pkgs/s6-*.rpm
# Packages can be found in /tmp/pkgs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment