Merge pull request #3307 from wy65701436/add-build-notary

build scripts for notary(signer/server) docker images based on photon 1.0
This commit is contained in:
Daniel Jiang 2017-09-29 17:23:19 +08:00 committed by GitHub
commit ddaad98526
5 changed files with 125 additions and 0 deletions

View File

@ -0,0 +1,13 @@
FROM golang:1.7.3
ENV NOTARY_DIR /go/src/github.com/docker/notary
ENV NOTARYPKG github.com/docker/notary
COPY . /go/src/${NOTARYPKG}
WORKDIR /go/src/${NOTARYPKG}
RUN go build -tags pkcs11 \
-ldflags "-w -X ${NOTARYPKG}/version.GitCommit=`git rev-parse --short HEAD` -X ${NOTARYPKG}/version.NotaryVersion=`cat NOTARY_VERSION`" $NOTARYPKG/cmd/notary-server
RUN go build -tags pkcs11 \
-ldflags "-w -X ${NOTARYPKG}/version.GitCommit=`git rev-parse --short HEAD` -X ${NOTARYPKG}/version.NotaryVersion=`cat NOTARY_VERSION`" $NOTARYPKG/cmd/notary-signer

View File

@ -0,0 +1,37 @@
#!/bin/bash
set +e
echo "Usage: #./builder_private [notary version]"
if [ -z $1 ]; then
error "Please set the 'version' variable"
exit 1
fi
VERSION="$1"
SIGNER_PHOTONIMAGE=vmware/notary-photon:signer-$VERSION
SERVER_PHOTONIMAGE=vmware/notary-photon:server-$VERSION
set -e
# the temp folder to store binary file...
mkdir -p binary
rm -rf binary/notary-server || true
rm -rf binary/notary-signer || true
cd `dirname $0`
cur=$PWD
# It won't store the notray binary in Harbor repo, so far it's a temporary solution..
TEMP=`mktemp -d /$TMPDIR/notary.XXXXXX`
git clone https://github.com/reasonerjt/notary-photon $TEMP
echo 'build the notary binary bases on the golang:1.7.3...'
cp -rf $TEMP/migrations .
cp $TEMP/migrate .
cp $TEMP/notary-server ./binary/
cp $TEMP/notary-signer ./binary/
docker build -f server.Dockerfile -t $SERVER_PHOTONIMAGE .
docker build -f signer.Dockerfile -t $SIGNER_PHOTONIMAGE .

View File

@ -0,0 +1,59 @@
#!/bin/bash
set +e
echo "Usage: #./builder [notary version] [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
VERSION="$1"
USERNAME="$2"
PASSWORD="$3"
SIGNER_PHOTONIMAGE=vmware/notary-photon:signer-$VERSION
SERVER_PHOTONIMAGE=vmware/notary-photon:server-$VERSION
set -e
# the temp folder to store binary file...
mkdir -p binary
rm -rf binary/notary-server || true
rm -rf binary/notary-signer || true
cd `dirname $0`
cur=$PWD
# the temp folder to store notary source code...
TEMP=`mktemp -d /$TMPDIR/notary.XXXXXX`
git clone -b $VERSION https://github.com/docker/notary.git $TEMP
echo 'build the notary binary bases on the golang:1.7.3...'
cp binary.Dockerfile $TEMP
cd $TEMP
docker build -f binary.Dockerfile -t notary-golang $TEMP
echo 'copy the notary binary to local...'
ID=$(docker create notary-golang)
echo $ID
cd $cur
docker cp $ID:/go/src/github.com/docker/notary/notary-server binary
docker cp $ID:/go/src/github.com/docker/notary/notary-signer binary
docker rm -f $ID
docker rmi -f notary-golang
docker build -f server.Dockerfile -t $SERVER_PHOTONIMAGE .
docker build -f signer.Dockerfile -t $SIGNER_PHOTONIMAGE .
echo 'Push image to docker hub.'
../../pushimage.sh $PHOTONIMAGE $USERNAME $PASSWORD

View File

@ -0,0 +1,8 @@
from library/photon:1.0
COPY ./binary/notary-server /bin/notary-server
COPY ./migrate /bin/migrate
COPY ./migrations/ /migrations/
ENV SERVICE_NAME=notary_server
ENTRYPOINT [ "notary-server" ]

View File

@ -0,0 +1,8 @@
from library/photon:1.0
COPY ./binary/notary-signer /bin/notary-signer
COPY ./migrate /bin/migrate
COPY ./migrations/ /migrations/
ENV SERVICE_NAME=notary_signer
ENTRYPOINT [ "notary-signer" ]