#!/bin/sh main(){ local REPOSITORY=${1}; if [ -z "${REPOSITORY}" ]; then echo "First argument must be container repository"; exit 1; fi local FROM=${2:-beta}; local TO=${3:-prod}; local CONTENT_TYPE="application/vnd.docker.distribution.manifest.v2+json"; local REGISTRY_URL="https://git.vdhsn.com/v2/${REPOSITORY}/manifests"; export MANIFEST=$(curl -u "${DOCKER_USERNAME}:${DOCKER_PASSWORD}" \ -H "Accept: ${CONTENT_TYPE}" "${REGISTRY_URL}/${FROM}"); curl -u "${DOCKER_USERNAME}:${DOCKER_PASSWORD}" \ -X PUT -H "Content-Type: ${CONTENT_TYPE}" -d "${MANIFEST}" "${REGISTRY_URL}/${TO}"; }