Skip to content

Commit

Permalink
Merge pull request #81 from docker/2.6.2-multi-arch
Browse files Browse the repository at this point in the history
Support arm and arm64 binaries for v2.6.2
  • Loading branch information
David Wu committed Dec 4, 2018
2 parents 15dbd1a + eb58390 commit 958adb1
Show file tree
Hide file tree
Showing 15 changed files with 151 additions and 8 deletions.
17 changes: 17 additions & 0 deletions Dockerfile.noarch
Original file line number Diff line number Diff line change
@@ -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"]
4 changes: 2 additions & 2 deletions Dockerfile → amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions amd64/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 renamed registry/registry → amd64/registry
Binary file not shown.
17 changes: 17 additions & 0 deletions arm/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 changes: 18 additions & 0 deletions arm/config-example.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions arm/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 added arm/registry
Binary file not shown.
17 changes: 17 additions & 0 deletions arm64/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 changes: 18 additions & 0 deletions arm64/config-example.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions arm64/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 added arm64/registry
Binary file not shown.
18 changes: 18 additions & 0 deletions config-example.yml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 14 additions & 6 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."

0 comments on commit 958adb1

Please sign in to comment.