github.com/tmlbl/deis@v1.0.2/controller/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 controller locally"
     9    echo
    10    exit 1
    11  fi
    12  
    13  DEBIAN_FRONTEND=noninteractive
    14  
    15  # install required system packages
    16  # HACK: install git so we can install bacongobbler's fork of django-fsm
    17  # install openssh-client for temporary fleetctl wrapper
    18  apt-get update && \
    19      apt-get install -yq python-dev libffi-dev libpq-dev libyaml-dev git
    20  
    21  # install pip
    22  curl -sSL https://raw.githubusercontent.com/pypa/pip/1.5.6/contrib/get-pip.py | python -
    23  
    24  # add a deis user that has passwordless sudo (for now)
    25  useradd deis --groups sudo --home-dir /app --shell /bin/bash
    26  sed -i -e 's/%sudo\tALL=(ALL:ALL) ALL/%sudo\tALL=(ALL:ALL) NOPASSWD:ALL/' /etc/sudoers
    27  
    28  # create a /app directory for storing application data
    29  mkdir -p /app && chown -R deis:deis /app
    30  
    31  # create directory for confd templates
    32  mkdir -p /templates && chown -R deis:deis /templates
    33  
    34  # install dependencies
    35  pip install -r /app/requirements.txt
    36  
    37  # cleanup. indicate that python, libpq and libyanl are required packages.
    38  apt-mark unmarkauto python python-openssl libpq5 libpython2.7 libffi6 libyaml-0-2 && \
    39    apt-get remove -y --purge python-dev gcc cpp libffi-dev libpq-dev libyaml-dev git && \
    40    apt-get autoremove -y --purge && \
    41    apt-get clean -y && \
    42    rm -Rf /usr/share/man /usr/share/doc && \
    43    rm -rf /tmp/* /var/tmp/* && \
    44    rm -rf /var/lib/apt/lists/*