Skip to content

Commit 91164f6

Browse files
committed
feat(registry): image without development libraries to reduce the size.
1 parent d9dd781 commit 91164f6

2 files changed

Lines changed: 41 additions & 28 deletions

File tree

controller/Dockerfile

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,13 @@ RUN curl -sSL -o /usr/local/bin/etcdctl https://s3-us-west-2.amazonaws.com/opdem
1313
RUN curl -sSL -o /usr/local/bin/confd https://s3-us-west-2.amazonaws.com/opdemand/confd-v0.5.0-json \
1414
&& chmod +x /usr/local/bin/confd
1515

16-
# install required system packages
17-
# HACK: install git so we can install bacongobbler's fork of django-fsm
18-
# install openssh-client for temporary fleetctl wrapper
19-
RUN apt-get update && \
20-
apt-get install -yq python-dev libpq-dev libyaml-dev git openssh-client
21-
22-
# install pip
23-
RUN curl -sSL https://raw.githubusercontent.com/pypa/pip/1.5.6/contrib/get-pip.py | python -
24-
25-
# add a deis user that has passwordless sudo (for now)
26-
RUN useradd deis --groups sudo --home-dir /app --shell /bin/bash
27-
RUN sed -i -e 's/%sudo\tALL=(ALL:ALL) ALL/%sudo\tALL=(ALL:ALL) NOPASSWD:ALL/' /etc/sudoers
28-
29-
# create a /app directory for storing application data
30-
RUN mkdir -p /app && chown -R deis:deis /app
31-
32-
# create directory for confd templates
33-
RUN mkdir -p /templates && chown -R deis:deis /templates
34-
35-
# create directory for logs
36-
RUN mkdir -p /var/log/deis && chown -R deis:deis /var/log/deis
37-
3816
# define execution environment
3917
CMD ["/app/bin/boot"]
4018
EXPOSE 8000
4119

4220
# define work environment
4321
WORKDIR /app
4422

45-
# install dependencies
46-
ADD requirements.txt /app/requirements.txt
47-
RUN pip install -r /app/requirements.txt
48-
4923
ADD . /app
5024

51-
# Create static resources
52-
RUN /app/manage.py collectstatic --settings=deis.settings --noinput
25+
RUN /app/build.sh

controller/build.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
3+
DEBIAN_FRONTEND=noninteractive
4+
5+
# install required system packages
6+
# HACK: install git so we can install bacongobbler's fork of django-fsm
7+
# install openssh-client for temporary fleetctl wrapper
8+
apt-get update && \
9+
apt-get install -yq python-dev libpq-dev libyaml-dev git
10+
11+
# install pip
12+
curl -sSL https://raw.githubusercontent.com/pypa/pip/1.5.6/contrib/get-pip.py | python -
13+
14+
# add a deis user that has passwordless sudo (for now)
15+
useradd deis --groups sudo --home-dir /app --shell /bin/bash
16+
sed -i -e 's/%sudo\tALL=(ALL:ALL) ALL/%sudo\tALL=(ALL:ALL) NOPASSWD:ALL/' /etc/sudoers
17+
18+
# create a /app directory for storing application data
19+
mkdir -p /app && chown -R deis:deis /app
20+
21+
# create directory for confd templates
22+
mkdir -p /templates && chown -R deis:deis /templates
23+
24+
# create directory for logs
25+
mkdir -p /var/log/deis && chown -R deis:deis /var/log/deis
26+
27+
# install dependencies
28+
pip install -r /app/requirements.txt
29+
30+
# Create static resources
31+
/app/manage.py collectstatic --settings=deis.settings --noinput
32+
33+
# cleanup. indicate that python, libpq and libyanl are required packages.
34+
apt-mark unmarkauto python python-openssl libpq5 libpython2.7 libyaml-0-2 && \
35+
apt-get remove -y --purge python-dev gcc cpp libpq-dev libyaml-dev git && \
36+
apt-get autoremove -y --purge && \
37+
apt-get clean -y && \
38+
rm -Rf /usr/share/man /usr/share/doc && \
39+
rm -rf /tmp/* /var/tmp/* && \
40+
rm -rf /var/lib/apt/lists/*

0 commit comments

Comments
 (0)