Skip to content

Commit 90fb6e1

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

2 files changed

Lines changed: 42 additions & 27 deletions

File tree

registry/Dockerfile

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,6 @@ 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 packages (copied from dotcloud/docker-registry Dockerfile)
17-
RUN sed -i 's/main$/main universe/' /etc/apt/sources.list
18-
RUN apt-get update && apt-get install -y git-core build-essential python-dev \
19-
libevent-dev python-openssl liblzma-dev
20-
21-
# install pip
22-
RUN curl -sSL https://raw.githubusercontent.com/pypa/pip/1.5.6/contrib/get-pip.py | python -
23-
24-
# create a registry user
25-
RUN useradd -s /bin/bash registry
26-
27-
# add the docker registry source from github
28-
RUN git clone https://github.com/deis/docker-registry /docker-registry && \
29-
cd /docker-registry && \
30-
git checkout 94e7707 && \
31-
chown -R registry:registry /docker-registry
32-
33-
# install boto configuration
34-
RUN cp /docker-registry/config/boto.cfg /etc/boto.cfg
35-
RUN cd /docker-registry && pip install -r requirements/main.txt
36-
37-
# Install core
38-
RUN pip install /docker-registry/depends/docker-registry-core
39-
40-
# Install registry
41-
RUN pip install file:///docker-registry#egg=docker-registry[bugsnag,newrelic,cors]
42-
4316
ENV DOCKER_REGISTRY_CONFIG /docker-registry/config/config.yml
4417
ENV SETTINGS_FLAVOR deis
4518

@@ -48,3 +21,5 @@ WORKDIR /app
4821
CMD ["/app/bin/boot"]
4922
EXPOSE 5000
5023
ADD . /app
24+
25+
RUN /app/build.sh

registry/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+
sed -i 's/main$/main universe/' /etc/apt/sources.list
6+
7+
# install required packages (copied from dotcloud/docker-registry Dockerfile)
8+
apt-get install -y git-core build-essential python-dev \
9+
libevent-dev python-openssl liblzma-dev
10+
11+
# install pip
12+
curl -sSL https://raw.githubusercontent.com/pypa/pip/1.5.6/contrib/get-pip.py | python -
13+
14+
# create a registry user
15+
useradd -s /bin/bash registry
16+
17+
# add the docker registry source from github
18+
git clone https://github.com/deis/docker-registry /docker-registry && \
19+
cd /docker-registry && \
20+
git checkout 94e7707 && \
21+
chown -R registry:registry /docker-registry
22+
23+
# install boto configuration
24+
cp /docker-registry/config/boto.cfg /etc/boto.cfg
25+
cd /docker-registry && pip install -r requirements/main.txt
26+
27+
# Install core
28+
pip install /docker-registry/depends/docker-registry-core
29+
30+
# Install registry
31+
pip install file:///docker-registry#egg=docker-registry[bugsnag,newrelic,cors]
32+
33+
# cleanup. indicate that python is a required package.
34+
apt-mark unmarkauto python python-openssl && \
35+
apt-get remove -y --purge git-core build-essential python-dev && \
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)