mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-22 14:52:17 +01:00
commit
0659edeebc
@ -6,7 +6,7 @@ MAINTAINER wangyan@vmware.com
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod u+x /entrypoint.sh
|
||||
|
||||
COPY registry /usr/bin
|
||||
COPY binary/registry /usr/bin
|
||||
RUN chmod u+x /usr/bin/registry
|
||||
|
||||
VOLUME ["/var/lib/registry"]
|
||||
|
10
make/photon/registry/Dockerfile.binary
Normal file
10
make/photon/registry/Dockerfile.binary
Normal file
@ -0,0 +1,10 @@
|
||||
FROM golang:1.7.3
|
||||
|
||||
ENV DISTRIBUTION_DIR /go/src/github.com/docker/distribution
|
||||
ENV DOCKER_BUILDTAGS include_oss include_gcs
|
||||
|
||||
WORKDIR $DISTRIBUTION_DIR
|
||||
COPY . $DISTRIBUTION_DIR
|
||||
COPY cmd/registry/config-dev.yml /etc/docker/registry/config.yml
|
||||
|
||||
RUN make PREFIX=/go clean binaries
|
62
make/photon/registry/builder
Executable file
62
make/photon/registry/builder
Executable file
@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
set +e
|
||||
|
||||
echo "Usage: #./builder [registry version] [photon tag] [registry username] [registry password]"
|
||||
if [ -z $1 ]; then
|
||||
error "Please set the 'version' variable"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z $2 ]; then
|
||||
error "Please set the 'photonversion' variable"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z $3 ]; then
|
||||
error "Please set the 'username' variable"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z $4 ]; then
|
||||
error "Please set the 'password' variable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION="$1"
|
||||
PHOTONVERSION="$2"
|
||||
USERNAME="$3"
|
||||
PASSWORD="$4"
|
||||
PHOTONIMAGE=vmware/registry:$PHOTONVERSION
|
||||
|
||||
set -e
|
||||
|
||||
# the temp folder to store binary file...
|
||||
mkdir -p binary
|
||||
rm -rf binary/registry || true
|
||||
|
||||
cd `dirname $0`
|
||||
cur=$PWD
|
||||
|
||||
# the temp folder to store distribution source code...
|
||||
TEMP=`mktemp -d /$TMPDIR/distribution.XXXXXX`
|
||||
git clone -b $VERSION https://github.com/docker/distribution.git $TEMP
|
||||
|
||||
echo 'build the registry binary bases on the golang:1.7.3...'
|
||||
cp Dockerfile.binary $TEMP
|
||||
docker build -f $TEMP/Dockerfile.binary -t registry-golang $TEMP
|
||||
|
||||
echo 'copy the registry binary to local...'
|
||||
ID=$(docker create registry-golang)
|
||||
docker cp $ID:/go/bin/registry binary
|
||||
|
||||
docker rm -f $ID
|
||||
docker rmi -f registry-golang
|
||||
|
||||
echo "Build registry binary success, then to build photon image..."
|
||||
cd $cur
|
||||
echo $PHOTONIMAGE
|
||||
docker build -f Dockerfile -t $PHOTONIMAGE .
|
||||
|
||||
rm -rf $TEMP
|
||||
rm -rf binary
|
||||
|
||||
echo 'Push image to docker hub.'
|
||||
../../pushimage.sh $PHOTONIMAGE USERNAME PASSWORD
|
10
make/photon/registry/entrypoint.sh
Normal file
10
make/photon/registry/entrypoint.sh
Normal 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 "$@"
|
Loading…
Reference in New Issue
Block a user