|
@@ -14,15 +14,33 @@ set -e
|
|
|
|
|
|
# Print a usage message and exit.
|
|
|
usage() {
|
|
|
- echo "Usage: $0 VERSION BUCKET"
|
|
|
- echo "For example: $0 0.5.1-dev sandbox.get.docker.io"
|
|
|
+ cat <<EOF
|
|
|
+To run, I need:
|
|
|
+- to be in a container generated by the Dockerfile at the top of the Docker
|
|
|
+ repository;
|
|
|
+- to be provided with the name of an S3 bucket, in environment variable
|
|
|
+ AWS_S3_BUCKET;
|
|
|
+- to be provided with AWS credentials for this S3 bucket, in environment
|
|
|
+ variables AWS_ACCESS_KEY and AWS_SECRET_KEY;
|
|
|
+- a generous amount of good will and nice manners.
|
|
|
+The canonical way to run me is to run the image produced by the Dockerfile: e.g.:"
|
|
|
+
|
|
|
+docker run -e AWS_S3_BUCKET=get-staging.docker.io \\
|
|
|
+ AWS_ACCESS_KEY=AKI1234... \\
|
|
|
+ AWS_SECRET_KEY=sEs3mE... \\
|
|
|
+ f0058411
|
|
|
+EOF
|
|
|
exit 1
|
|
|
}
|
|
|
|
|
|
-VERSION=$1
|
|
|
-BUCKET=$2
|
|
|
-[ -z "$VERSION" ] && usage
|
|
|
-[ -z "$BUCKET" ] && usage
|
|
|
+[ "$AWS_S3_BUCKET" ] || usage
|
|
|
+[ "$AWS_ACCESS_KEY" ] || usage
|
|
|
+[ "$AWS_SECRET_KEY" ] || usage
|
|
|
+[ -d /go/src/github.com/dotcloud/docker/ ] || usage
|
|
|
+cd /go/src/github.com/dotcloud/docker/
|
|
|
+
|
|
|
+VERSION=$(cat VERSION)
|
|
|
+BUCKET=s3://$AWS_S3_BUCKET
|
|
|
|
|
|
setup_s3() {
|
|
|
# Try creating the bucket. Ignore errors (it might already exist).
|