mirror_frr/docker/alpine/Dockerfile
Arthur Jones 79bb456408 docker build: build Alpine Linux dev packages in docker
Building alpine packages in a "standard" distro can be
complicated due to the limited scope of the distro (embedded
and small docker images).  Building in a VM is one possibility,
but docker support for alpine is very good (default docker images
come in alpine due to the very small size).

Here, we want to package up the current git repo into apk packages
that can be easily installed in alpine linux using the apk tool.
This support is not intended to package released versions of
apk packages, that, if it comes to be, should be done here:

git://git.alpinelinux.org/aports

We're content here to build packages that can be used by developers
to try out frr in docker and other alpine environments.

This is a very minimal environment, we don't support importing
keys (so, installing the packages with apk requires the
--allow-untrusted option).  In addition, we can't use the
git commit id in hex as version tag, as alpine doesn't support hex
digits in the version string.  So, we need to convert the git hash
to decimal before tagging the package with the extra version.
This is yucky, but I can't think of another way to get a
unique version per package.  The alpine way (using a numeric date),
only works for released packages, not for dev packages.

Issue: https://github.com/FRRouting/frr/issues/1859
Signed-off-by: Arthur Jones <arthur.jones@riverbed.com>
2018-03-19 13:05:26 -07:00

31 lines
1.3 KiB
Docker

FROM alpine:3.7 as source-builder
ARG commit
RUN apk add --no-cache abuild acct alpine-sdk attr autoconf automake bash \
binutils binutils-libs bison bsd-compat-headers build-base \
c-ares c-ares-dev ca-certificates cryptsetup-libs curl \
device-mapper-libs expat fakeroot flex fortify-headers g++ gcc gdbm \
git gmp isl json-c json-c-dev kmod lddtree libacl libatomic libattr \
libblkid libburn libbz2 libc-dev libcap libcurl libedit libffi libgcc \
libgomp libisoburn libisofs libltdl libressl libssh2 \
libstdc++ libtool libuuid linux-headers lzip lzo m4 make mkinitfs mpc1 \
mpfr3 mtools musl-dev ncurses-libs ncurses-terminfo ncurses-terminfo-base \
patch pax-utils pcre perl pkgconf python2 python2-dev readline \
readline-dev sqlite-libs squashfs-tools sudo tar texinfo xorriso xz-libs \
groff gzip bc py-sphinx
RUN mkdir -p /src
ADD src.tar /src
RUN (cd /src && \
./bootstrap.sh && \
./configure \
--enable-numeric-version \
--with-pkg-extra-version=_git$commit && \
make dist)
FROM alpine:3.7 as alpine-builder
RUN apk add --no-cache abuild alpine-sdk && mkdir -p /pkgs/apk
ADD alpine-build.sh /usr/bin/
ADD builder /etc/sudoers.d
COPY --from=source-builder /src/*.tar.gz /src/alpine/APKBUILD /dist/
RUN adduser -D -G abuild builder && chown -R builder /dist /pkgs
USER builder
RUN /usr/bin/alpine-build.sh