1
0
mirror of https://github.com/distribution/distribution-library-image synced 2024-11-12 05:15:50 +01:00
distribution-library-image/update.sh
Aaron Lehmann c017c8583d Add library image for registry
This is based on swarm-library-image.

Unfortunately, the registry binary needs to be checked in - otherwise
"docker build" wouldn't work without preparation, as is required of
official images. The binary checked in here is from distribution's
current master branch (4cc4d440f6afc7b27c2220993d01a4e2889d87c0). It
will need to be updated to the release version after each release.

Rather than creating a container from scratch, this library image is
based on the ubuntu container, because registry is a dynamically linked
binary.

Because we're using the ubuntu container as a base, manual installation
of ca-certificates.crt isn't necessary. If we end up switching to a
scratch container, this will need to be re-added.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-30 17:50:03 -07:00

35 lines
831 B
Bash
Executable File

#!/bin/bash
set -e
if [ $# -eq 0 ] ; then
echo "Usage: ./update.sh <docker/distribution tag or branch>"
exit
fi
VERSION=$1
# cd to the current directory so the script can be run from anywhere.
cd `dirname $0`
echo "Fetching and building distribution $VERSION..."
# Create a temporary directory.
TEMP=`mktemp -d /$TMPDIR/distribution.XXXXXX`
git clone -b $VERSION https://github.com/docker/distribution.git $TEMP
docker build -t distribution-builder $TEMP
# Create a dummy distribution-build container so we can run a cp against it.
ID=$(docker create distribution-builder)
# Update the local binary and config.
docker cp $ID:/go/bin/registry registry
docker cp $ID:/go/src/github.com/docker/distribution/cmd/registry/config-example.yml registry
# Cleanup.
docker rm -f $ID
docker rmi distribution-builder
echo "Done."