#!/usr/bin/env bash

if [ "$DEPLOYMENT" == "production" ]; then
    AWS_S3_BUCKET='test.docker.io'
else
    AWS_S3_BUCKET='get-staging.docker.io'
fi

docker run -rm -privileged -v /run:/var/socket \
    -e AWS_S3_BUCKET=$AWS_S3_BUCKET -e AWS_ACCESS_KEY=$AWS_ACCESS_KEY \
    -e AWS_SECRET_KEY=$AWS_SECRET_KEY -e GPG_PASSPHRASE=$GPG_PASSPHRASE \
    -e DOCKER_RELEASE=1 -e DEPLOYMENT=$DEPLOYMENT docker-ci/testbuilder docker

