github.com/technosophos/deis@v1.7.1-0.20150915173815-f9005256004b/registry/build.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # fail on any command exiting non-zero
     4  set -eo pipefail
     5  
     6  if [[ -z $DOCKER_BUILD ]]; then
     7    echo
     8    echo "Note: this script is intended for use by the Dockerfile and not as a way to build the registry locally"
     9    echo
    10    exit 1
    11  fi
    12  
    13  # install required packages (copied from dotcloud/docker-registry Dockerfile)
    14  apk add --update-cache \
    15    build-base \
    16    git \
    17    openssl-dev \
    18    python-dev \
    19    libffi-dev \
    20    swig \
    21    libevent-dev \
    22    xz-dev
    23  
    24  # install pip
    25  curl -sSL https://raw.githubusercontent.com/pypa/pip/7.0.3/contrib/get-pip.py | python -
    26  
    27  # workaround to python > 2.7.8 SSL issues
    28  pip install --disable-pip-version-check --no-cache-dir pyopenssl ndg-httpsclient pyasn1
    29  
    30  # create a registry user
    31  adduser -D -s /bin/bash registry
    32  
    33  # add the docker registry source from github
    34  git clone -b new-repository-import-master --single-branch https://github.com/deis/docker-registry /docker-registry && \
    35    chown -R registry:registry /docker-registry
    36  
    37  # install boto configuration
    38  cp /docker-registry/config/boto.cfg /etc/boto.cfg
    39  cd /docker-registry && pip install --disable-pip-version-check --no-cache-dir -r requirements/main.txt
    40  
    41  # Install core
    42  pip install --disable-pip-version-check --no-cache-dir /docker-registry/depends/docker-registry-core
    43  
    44  # Install registry
    45  pip install --disable-pip-version-check --no-cache-dir "file:///docker-registry#egg=docker-registry[bugsnag,newrelic,cors]"
    46  
    47  patch \
    48    "$(python -c 'import boto; import os; print os.path.dirname(boto.__file__)')/connection.py" \
    49    < /docker-registry/contrib/boto_header_patch.diff
    50  
    51  # cleanup. indicate that python is a required package.
    52  apk del --purge \
    53    build-base \
    54    linux-headers \
    55    python-dev
    56  
    57  rm -rf /var/cache/apk/*