summaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
authorArthur Jones <arthur.jones@riverbed.com>2018-04-04 04:15:11 +0200
committerArthur Jones <arthur.jones@riverbed.com>2018-04-04 19:05:44 +0200
commit19e622d51ee399d08d62d2c9d128e8b518a53fe6 (patch)
tree9b7ba9b7c5347ab5c83846649a9b55f7b9ff0fa3 /docker
parentMerge pull request #1993 from vivek-cumulus/evpn-fixes (diff)
downloadfrr-19e622d51ee399d08d62d2c9d128e8b518a53fe6.tar.xz
frr-19e622d51ee399d08d62d2c9d128e8b518a53fe6.zip
alpine packaging: build packages and base image directly from git
Currently, we tar up the git repo before building alpine packages. This ensures that the packages we're building are exactly what is checked in. But, in practice, this restriction causes us to not be able to build off of git contexts, which is a convenient feature especially when using docker-compose. So, here, we build the alpine packages directly from the contents of the current directory and we install the packages into a base image to ease downstream consumption. There is still work to be done in that area, as we need to package up the daemons, frr user and all the rest, but that's for later... Testing-done: Built directly from the git repo, built from a reference to the git repo and built using docker-compose, all seemed to work. Also, tested by @leleobhz and seems to build fine. Thanks to Leonardo Amaral (@leleobhz) for reporting the issue and for the original idea for a fix. Issue: https://github.com/FRRouting/frr/issues/2024 Signed-off-by: Arthur Jones <arthur.jones@riverbed.com>
Diffstat (limited to 'docker')
-rw-r--r--docker/.gitignore1
-rw-r--r--docker/alpine/Dockerfile11
-rwxr-xr-xdocker/alpine/build.sh8
3 files changed, 9 insertions, 11 deletions
diff --git a/docker/.gitignore b/docker/.gitignore
index e9beab556..6f91eb5ec 100644
--- a/docker/.gitignore
+++ b/docker/.gitignore
@@ -1,2 +1 @@
-src.tar
pkgs/
diff --git a/docker/alpine/Dockerfile b/docker/alpine/Dockerfile
index e186fdccd..6bd7d90ae 100644
--- a/docker/alpine/Dockerfile
+++ b/docker/alpine/Dockerfile
@@ -12,8 +12,7 @@ RUN apk add --no-cache abuild acct alpine-sdk attr autoconf automake bash \
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
+ADD . /src
RUN (cd /src && \
./bootstrap.sh && \
./configure \
@@ -22,9 +21,13 @@ RUN (cd /src && \
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
+ADD docker/alpine/alpine-build.sh /usr/bin/
+ADD docker/alpine/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
+FROM alpine:3.7
+RUN mkdir -p /pkgs/apk
+COPY --from=alpine-builder /pkgs/apk/ /pkgs/apk/
+RUN apk add --no-cache --allow-untrusted /pkgs/apk/x86_64/*.apk
diff --git a/docker/alpine/build.sh b/docker/alpine/build.sh
index 357ea12de..40ed1194f 100755
--- a/docker/alpine/build.sh
+++ b/docker/alpine/build.sh
@@ -9,12 +9,8 @@ set -x
##
c=`git rev-parse --short=10 HEAD`
commit=`printf '%u\n' 0x$c`
-git archive --format=tar $c > docker/alpine/src.tar
-(cd docker/alpine && \
- docker build --build-arg commit=$commit --rm --force-rm -t \
- frr:alpine-$c . && \
- rm -f src.tar)
-
+docker build -f docker/alpine/Dockerfile \
+ --build-arg commit=$commit -t frr:alpine-$c .
id=`docker create frr:alpine-$c`
docker cp ${id}:/pkgs/ docker
docker rm $id