Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
feat(registry): image without development libraries to reduce the size.
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf committed Oct 10, 2014
1 parent d9dd781 commit 91164f6
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 28 deletions.
29 changes: 1 addition & 28 deletions controller/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,13 @@ RUN curl -sSL -o /usr/local/bin/etcdctl https://s3-us-west-2.amazonaws.com/opdem
RUN curl -sSL -o /usr/local/bin/confd https://s3-us-west-2.amazonaws.com/opdemand/confd-v0.5.0-json \
&& chmod +x /usr/local/bin/confd

# install required system packages
# HACK: install git so we can install bacongobbler's fork of django-fsm
# install openssh-client for temporary fleetctl wrapper
RUN apt-get update && \
apt-get install -yq python-dev libpq-dev libyaml-dev git openssh-client

# install pip
RUN curl -sSL https://raw.githubusercontent.com/pypa/pip/1.5.6/contrib/get-pip.py | python -

# add a deis user that has passwordless sudo (for now)
RUN useradd deis --groups sudo --home-dir /app --shell /bin/bash
RUN sed -i -e 's/%sudo\tALL=(ALL:ALL) ALL/%sudo\tALL=(ALL:ALL) NOPASSWD:ALL/' /etc/sudoers

# create a /app directory for storing application data
RUN mkdir -p /app && chown -R deis:deis /app

# create directory for confd templates
RUN mkdir -p /templates && chown -R deis:deis /templates

# create directory for logs
RUN mkdir -p /var/log/deis && chown -R deis:deis /var/log/deis

# define execution environment
CMD ["/app/bin/boot"]
EXPOSE 8000

# define work environment
WORKDIR /app

# install dependencies
ADD requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt

ADD . /app

# Create static resources
RUN /app/manage.py collectstatic --settings=deis.settings --noinput
RUN /app/build.sh
40 changes: 40 additions & 0 deletions controller/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

DEBIAN_FRONTEND=noninteractive

# install required system packages
# HACK: install git so we can install bacongobbler's fork of django-fsm
# install openssh-client for temporary fleetctl wrapper
apt-get update && \
apt-get install -yq python-dev libpq-dev libyaml-dev git

# install pip
curl -sSL https://raw.githubusercontent.com/pypa/pip/1.5.6/contrib/get-pip.py | python -

# add a deis user that has passwordless sudo (for now)
useradd deis --groups sudo --home-dir /app --shell /bin/bash
sed -i -e 's/%sudo\tALL=(ALL:ALL) ALL/%sudo\tALL=(ALL:ALL) NOPASSWD:ALL/' /etc/sudoers

# create a /app directory for storing application data
mkdir -p /app && chown -R deis:deis /app

# create directory for confd templates
mkdir -p /templates && chown -R deis:deis /templates

# create directory for logs
mkdir -p /var/log/deis && chown -R deis:deis /var/log/deis

# install dependencies
pip install -r /app/requirements.txt

# Create static resources
/app/manage.py collectstatic --settings=deis.settings --noinput

# cleanup. indicate that python, libpq and libyanl are required packages.
apt-mark unmarkauto python python-openssl libpq5 libpython2.7 libyaml-0-2 && \
apt-get remove -y --purge python-dev gcc cpp libpq-dev libyaml-dev git && \
apt-get autoremove -y --purge && \
apt-get clean -y && \
rm -Rf /usr/share/man /usr/share/doc && \
rm -rf /tmp/* /var/tmp/* && \
rm -rf /var/lib/apt/lists/*

0 comments on commit 91164f6

Please sign in to comment.