Support arm and arm64 binaries for v2.6.2

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan 2018-11-27 17:04:48 -08:00
parent 15dbd1a011
commit eb58390c83
15 changed files with 151 additions and 8 deletions

17
Dockerfile.noarch Normal file
View File

@ -0,0 +1,17 @@
# Build a minimal distribution container
FROM alpine:3.4
RUN set -ex \
&& apk add --no-cache ca-certificates apache2-utils
COPY ./registry /bin/registry
COPY ./config-example.yml /etc/docker/registry/config.yml
VOLUME ["/var/lib/registry"]
EXPOSE 5000
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/etc/docker/registry/config.yml"]

View File

@ -5,8 +5,8 @@ FROM alpine:3.4
RUN set -ex \
&& apk add --no-cache ca-certificates apache2-utils
COPY ./registry/registry /bin/registry
COPY ./registry/config-example.yml /etc/docker/registry/config.yml
COPY ./registry /bin/registry
COPY ./config-example.yml /etc/docker/registry/config.yml
VOLUME ["/var/lib/registry"]
EXPOSE 5000

10
amd64/docker-entrypoint.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
set -e
case "$1" in
*.yaml|*.yml) set -- registry serve "$@" ;;
serve|garbage-collect|help|-*) set -- registry "$@" ;;
esac
exec "$@"

Binary file not shown.

17
arm/Dockerfile Normal file
View File

@ -0,0 +1,17 @@
# Build a minimal distribution container
FROM alpine:3.4
RUN set -ex \
&& apk add --no-cache ca-certificates apache2-utils
COPY ./registry /bin/registry
COPY ./config-example.yml /etc/docker/registry/config.yml
VOLUME ["/var/lib/registry"]
EXPOSE 5000
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/etc/docker/registry/config.yml"]

18
arm/config-example.yml Normal file
View File

@ -0,0 +1,18 @@
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3

10
arm/docker-entrypoint.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
set -e
case "$1" in
*.yaml|*.yml) set -- registry serve "$@" ;;
serve|garbage-collect|help|-*) set -- registry "$@" ;;
esac
exec "$@"

BIN
arm/registry Executable file

Binary file not shown.

17
arm64/Dockerfile Normal file
View File

@ -0,0 +1,17 @@
# Build a minimal distribution container
FROM alpine:3.4
RUN set -ex \
&& apk add --no-cache ca-certificates apache2-utils
COPY ./registry /bin/registry
COPY ./config-example.yml /etc/docker/registry/config.yml
VOLUME ["/var/lib/registry"]
EXPOSE 5000
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/etc/docker/registry/config.yml"]

18
arm64/config-example.yml Normal file
View File

@ -0,0 +1,18 @@
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3

10
arm64/docker-entrypoint.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
set -e
case "$1" in
*.yaml|*.yml) set -- registry serve "$@" ;;
serve|garbage-collect|help|-*) set -- registry "$@" ;;
esac
exec "$@"

BIN
arm64/registry Executable file

Binary file not shown.

18
config-example.yml Normal file
View File

@ -0,0 +1,18 @@
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3

View File

@ -9,26 +9,34 @@ fi
VERSION=$1
if [ "$GOARCH" == "" ] ; then
echo "Must set GOARCH in environment"
exit
fi
# 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`
TEMP=`mktemp -d --tmpdir distribution.XXXXXX`
git clone -b $VERSION https://github.com/docker/distribution.git $TEMP
docker build -t distribution-builder $TEMP
docker build --build-arg GOARCH=$GOARCH --build-arg GOARM=$GOARM -t distribution-builder-$GOARCH $TEMP
# Create a dummy distribution-build container so we can run a cp against it.
ID=$(docker create distribution-builder)
ID=$(docker create distribution-builder-$GOARCH)
# 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
docker cp $ID:/go/bin/registry $GOARCH
docker cp $ID:/go/src/github.com/docker/distribution/cmd/registry/config-example.yml $GOARCH
# Cleanup.
docker rm -f $ID
docker rmi distribution-builder
docker rmi distribution-builder-$GOARCH
cp Dockerfile.noarch $GOARCH/Dockerfile
cp docker-entrypoint.sh config-example.yml $GOARCH
echo "Done."