diff options
author | Christian Franke <chris@opensourcerouting.org> | 2019-03-26 12:56:23 +0100 |
---|---|---|
committer | Christian Franke <chris@opensourcerouting.org> | 2019-03-26 18:32:50 +0100 |
commit | e3f80e1e2fb7bfb2d5f5a61c03b6d78c6c2164fd (patch) | |
tree | e94b96a4d346145ccd8ae5182a967418115c0191 | |
parent | alpine: Move docker-start to Docker build (diff) | |
download | frr-e3f80e1e2fb7bfb2d5f5a61c03b6d78c6c2164fd.tar.xz frr-e3f80e1e2fb7bfb2d5f5a61c03b6d78c6c2164fd.zip |
docker/alpine: Unbreak build by using edge/testing
As we need libyang, which is only part of Alpine Linux edge/testing,
update the Dockerfile to use this repository.
Also, update the Dockerfile to adhere more to best common practices.
-rw-r--r-- | docker/alpine/Dockerfile | 77 | ||||
-rwxr-xr-x | docker/alpine/alpine-build.sh | 11 | ||||
-rw-r--r-- | docker/alpine/builder | 1 |
3 files changed, 49 insertions, 40 deletions
diff --git a/docker/alpine/Dockerfile b/docker/alpine/Dockerfile index f19f1e877..80ddb30d5 100644 --- a/docker/alpine/Dockerfile +++ b/docker/alpine/Dockerfile @@ -1,36 +1,57 @@ -FROM alpine:3.7 as source-builder +# This stage builds a dist tarball from the source +FROM alpine:edge 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 -ADD . /src -RUN (cd /src && \ - ./bootstrap.sh && \ - ./configure \ + +RUN mkdir -p /src/alpine +COPY alpine/APKBUILD.in /src/alpine +RUN source /src/alpine/APKBUILD.in \ + && echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories \ + && apk add \ + --no-cache \ + --update-cache \ + $makedepends \ + gzip + +COPY . /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 docker/alpine/alpine-build.sh /usr/bin/ -ADD docker/alpine/builder /etc/sudoers.d -COPY --from=source-builder /src/*.tar.gz /src/alpine/* /src/tools/etc/frr/daemons* /dist/ + --with-pkg-extra-version=_git$commit \ + && make dist + +# This stage builds an apk from the dist tarball +FROM alpine:edge as alpine-builder +# Don't use nocache here so that abuild can use the cache +RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories \ + && apk add \ + --update-cache \ + abuild \ + alpine-conf \ + alpine-sdk \ + && setup-apkcache /var/cache/apk \ + && mkdir -p /pkgs/apk \ + && echo 'builder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +COPY --from=source-builder /src/frr-*.tar.gz /src/alpine/* /dist/ RUN adduser -D -G abuild builder && chown -R builder /dist /pkgs USER builder -RUN /usr/bin/alpine-build.sh -FROM alpine:3.7 +RUN cd /dist \ + && abuild-keygen -a -n \ + && abuild checksum \ + && abuild -r -P /pkgs/apk + +# This stage installs frr from the apk +FROM alpine:edge RUN mkdir -p /pkgs/apk COPY --from=alpine-builder /pkgs/apk/ /pkgs/apk/ -RUN apk add --no-cache tini -RUN apk add --no-cache --allow-untrusted /pkgs/apk/x86_64/*.apk +RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories \ + && apk add \ + --no-cache \ + --update-cache \ + tini \ + && apk add \ + --no-cache \ + --allow-untrusted /pkgs/apk/*/*.apk COPY docker/alpine/docker-start /usr/lib/frr/docker-start ENTRYPOINT [ "/sbin/tini", "--", "/usr/lib/frr/docker-start" ] diff --git a/docker/alpine/alpine-build.sh b/docker/alpine/alpine-build.sh deleted file mode 100755 index d4c031112..000000000 --- a/docker/alpine/alpine-build.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -set -e - -cd /dist - -sudo apk --update add alpine-conf -sudo setup-apkcache /var/cache/apk -abuild-keygen -a -n -abuild checksum -abuild -r -P /pkgs/apk diff --git a/docker/alpine/builder b/docker/alpine/builder deleted file mode 100644 index a950b8aba..000000000 --- a/docker/alpine/builder +++ /dev/null @@ -1 +0,0 @@ -builder ALL=(ALL) NOPASSWD:ALL |