github.com/inflatablewoman/deis@v1.0.1-0.20141111034523-a4511c46a6ce/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  DEBIAN_FRONTEND=noninteractive
    14  
    15  sed -i 's/main$/main universe/' /etc/apt/sources.list
    16  
    17  # install required packages (copied from dotcloud/docker-registry Dockerfile)
    18  apt-get update && \
    19      apt-get install -y git-core build-essential python-dev \
    20      libevent-dev python-openssl liblzma-dev
    21  
    22  # install pip
    23  curl -sSL https://raw.githubusercontent.com/pypa/pip/1.5.6/contrib/get-pip.py | python -
    24  
    25  # create a registry user
    26  useradd -s /bin/bash registry
    27  
    28  # add the docker registry source from github
    29  git clone https://github.com/deis/docker-registry /docker-registry && \
    30      cd /docker-registry && \
    31      git checkout 94e7707 && \
    32      chown -R registry:registry /docker-registry
    33  
    34  # install boto configuration
    35  cp /docker-registry/config/boto.cfg /etc/boto.cfg
    36  cd /docker-registry && pip install -r requirements/main.txt
    37  
    38  # Install core
    39  pip install /docker-registry/depends/docker-registry-core
    40  
    41  # Install registry
    42  pip install file:///docker-registry#egg=docker-registry[bugsnag,newrelic,cors]
    43  
    44  # cleanup. indicate that python is a required package.
    45  apt-mark unmarkauto python python-openssl && \
    46    apt-get remove -y --purge git-core build-essential python-dev && \
    47    apt-get autoremove -y --purge && \
    48    apt-get clean -y && \
    49    rm -Rf /usr/share/man /usr/share/doc && \
    50    rm -rf /tmp/* /var/tmp/* && \
    51    rm -rf /var/lib/apt/lists/*