Move weave script into tools image with its deps
This rearrangement means that the `weave` command can be used remotely; and, as a side-effect, the script that does all the work is using executables in its own filesystem, rather than invoking them via docker. The remote weavetools is given a terminal so it can be interrupted. With the flag `--local`, the script will assume all its dependencies are available and run then and there. Without the flag, it will run via the weavetools image (adding the flag to the invocation). A choice here is whether to base the tools image on scratch and add all the deps, or base it on something else. I've used alpine linux, which itself is based on busybox. This gives us the usual tools (sed etc.) while keeping the image size small. Adding the docker binary adds substantially to the image size, but it cannot always be e.g., bind-mounted. To mitigate this image bloat, we might build or otherwise get a client-only docker executable, or write a special-purpose client, or indeed rewrite the driver script and use a client library. This also makes the dockerhub user part of the image names parameterised, to make it easier to test the release process in full.
This commit is contained in:
1 parent
e15f52b4cb
commit
8d12810446
4 files changed
+51
-112
No files matched your search
+5
-2
@@ -1,3 +1,6 @@
|
||||
FROM scratch
|
||||
FROM gliderlabs/alpine
|
||||
MAINTAINER Weaveworks Inc <help@weave.works>
|
||||
ADD ./bin /bin
|
||||
WORKDIR /home/weave
|
||||
RUN ["apk-install", "ethtool", "conntrack-tools", "curl", "iptables", "iproute2", "docker"]
|
||||
ADD ./weave /home/weave/
|
||||
ENTRYPOINT ["/home/weave/weave"]
|
||||
@@ -1,62 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Show the progress of this script, in case it fails.
|
||||
set -x -e
|
||||
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install curl make pkg-config gcc bison flex
|
||||
|
||||
BASEDIR=$(dirname $0)
|
||||
mkdir -p "$BASEDIR"/bin
|
||||
|
||||
copy_exe() {
|
||||
if ldd $1 >/dev/null 2>&1 ; then
|
||||
echo "ERROR: $1 was not linked statically." 2>&1
|
||||
exit 1
|
||||
fi
|
||||
cp $1 "$BASEDIR"/bin/
|
||||
}
|
||||
|
||||
# ethtool
|
||||
|
||||
ETHTOOL=ethtool-3.16
|
||||
|
||||
rm -rf $ETHTOOL
|
||||
|
||||
curl -s -S https://www.kernel.org/pub/software/network/ethtool/$ETHTOOL.tar.gz | tar xvz
|
||||
(cd $ETHTOOL; ./configure LDFLAGS=-static && make)
|
||||
copy_exe $ETHTOOL/ethtool
|
||||
|
||||
# conntrack
|
||||
|
||||
PACKAGES="libmnl-1.0.3 libnfnetlink-1.0.1 libnetfilter_cttimeout-1.0.0 libnetfilter_cthelper-1.0.0 libnetfilter_queue-1.0.2 libnetfilter_conntrack-1.0.4"
|
||||
CONNTRACK=conntrack-tools-1.4.2
|
||||
|
||||
rm -rf $PACKAGES $CONNTRACK
|
||||
|
||||
fetch() {
|
||||
curl -s -S http://www.netfilter.org/projects/${1%-*}/files/$1.tar.bz2 | tar xj
|
||||
}
|
||||
|
||||
for PACKAGE in $PACKAGES; do
|
||||
fetch $PACKAGE
|
||||
(cd $PACKAGE; ./configure --disable-shared && make && sudo make install)
|
||||
done
|
||||
|
||||
fetch $CONNTRACK
|
||||
(cd $CONNTRACK; ./configure --disable-shared && make && rm -f src/conntrack && make LDFLAGS=-all-static)
|
||||
copy_exe $CONNTRACK/src/conntrack
|
||||
|
||||
# curl
|
||||
|
||||
CURL=curl-7.40.0
|
||||
|
||||
rm -rf $CURL
|
||||
|
||||
curl -s -S http://curl.haxx.se/download/$CURL.tar.gz | tar xvz
|
||||
(cd $CURL; ./configure --without-ssl --disable-shared && make && rm src/curl && make LDFLAGS=-all-static)
|
||||
copy_exe $CURL/src/curl
|
||||
|
||||
#
|
||||
|
||||
touch "$BASEDIR"/bin
|
||||
Reference in new issue
Block a user