diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-09 13:16:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-09 13:16:35 +0000 |
commit | e2bbf175a2184bd76f6c54ccf8456babeb1a46fc (patch) | |
tree | f0b76550d6e6f500ada964a3a4ee933a45e5a6f1 /docker/alpine/Dockerfile | |
parent | Initial commit. (diff) | |
download | frr-e2bbf175a2184bd76f6c54ccf8456babeb1a46fc.tar.xz frr-e2bbf175a2184bd76f6c54ccf8456babeb1a46fc.zip |
Adding upstream version 9.1.upstream/9.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docker/alpine/Dockerfile')
-rw-r--r-- | docker/alpine/Dockerfile | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/docker/alpine/Dockerfile b/docker/alpine/Dockerfile new file mode 100644 index 0000000..98e8407 --- /dev/null +++ b/docker/alpine/Dockerfile @@ -0,0 +1,82 @@ +# syntax=docker/dockerfile:1 + +# Create a basic stage set up to build APKs +FROM alpine:3.18 as alpine-builder +RUN 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 +RUN adduser -D -G abuild builder && su builder -c 'abuild-keygen -a -n' + +# This stage builds an APK for libyang +FROM alpine-builder as alpine-apk-builder-libyang +RUN mkdir -p /src/libyang +COPY docker/alpine/libyang/APKBUILD /src/libyang +RUN chown -R builder /pkgs /src +USER builder +RUN cd /src/libyang \ + && abuild checksum \ + && git init \ + && abuild -r -P /pkgs/apk + +# This stage builds a dist tarball from the source +FROM alpine:3.18 as source-builder +RUN mkdir -p /src/alpine /pkgs/apk +COPY alpine/APKBUILD.in /src/alpine +COPY --from=alpine-apk-builder-libyang /pkgs/apk/src /pkgs/apk +RUN cd /pkgs/apk && apk add --allow-untrusted */*.apk +RUN source /src/alpine/APKBUILD.in \ + && apk add \ + --no-cache \ + --update-cache \ + $makedepends \ + && pip install pytest +COPY . /src +ARG PKGVER +RUN cd /src \ + && ./bootstrap.sh \ + && ./configure \ + --enable-numeric-version \ + --with-pkg-extra-version="_git$PKGVER" \ + && make dist + +# This stage builds an APK from the dist tarball +FROM alpine-builder as alpine-apk-builder +COPY --from=source-builder /src/frr-*.tar.gz /src/alpine/* /dist/ +COPY --from=alpine-apk-builder-libyang /pkgs/apk/src /pkgs/apk +RUN cd /pkgs/apk && apk add --allow-untrusted */*.apk +RUN find /pkgs/apk -type f -name APKINDEX.tar.gz -delete +RUN chown -R builder /dist /pkgs +USER builder +RUN cd /dist \ + && abuild checksum \ + && git init \ + && abuild -r -P /pkgs/apk + +# This stage installs frr from the apk +FROM alpine:3.18 +RUN mkdir -p /pkgs/apk +COPY --from=alpine-apk-builder /pkgs/apk/ /pkgs/apk/ +RUN apk add \ + --no-cache \ + --update-cache \ + tini \ + && apk add \ + --no-cache \ + --allow-untrusted /pkgs/apk/*/*.apk \ + && rm -rf /pkgs + +# Own the config / PID files +RUN mkdir -p /var/run/frr +RUN chown -R frr:frr /etc/frr /var/run/frr + +# Simple init manager for reaping processes and forwarding signals +ENTRYPOINT ["/sbin/tini", "--"] + +# Default CMD starts watchfrr +COPY docker/alpine/docker-start /usr/lib/frr/docker-start +CMD ["/usr/lib/frr/docker-start"] |