Update Dockerfile to better pattern

Add requirements layer
Add entrypoint.sh script to support future CLI
Change Dockerfile to use ENTRYPOINT
This commit is contained in:
Scott Hussey 2017-06-28 11:24:24 -05:00
parent 0a29beff5c
commit 4efe40d184
4 changed files with 45 additions and 11 deletions

View File

@ -13,20 +13,37 @@
# limitations under the License.
FROM ubuntu:16.04
ARG VERSION
ENV DEBIAN_FRONTEND noninteractive
ENV container docker
RUN apt -qq update && \
apt -y install git netbase python3-minimal python3-setuptools python3-pip python3-dev ca-certificates gcc g++ make libffi-dev libssl-dev --no-install-recommends
apt -y install git \
netbase \
python3-minimal \
python3-setuptools \
python3-pip \
python3-dev \
ca-certificates \
gcc \
g++ \
make \
libffi-dev \
libssl-dev --no-install-recommends
# Need to configure proxies?
RUN git clone https://github.com/sh8121att/drydock /tmp/drydock
# Copy direct dependency requirements only to build a dependency layer
COPY ./requirements-direct.txt /tmp/drydock/
RUN pip3 install -r /tmp/drydock/requirements-direct.txt
COPY . /tmp/drydock
WORKDIR /tmp/drydock
RUN python3 setup.py install
EXPOSE 9000
CMD ["/usr/bin/uwsgi","--http",":9000","-w","drydock_provisioner.drydock","--callable","drydock","--enable-threads","-L"]
COPY examples/drydock.conf /etc/drydock/drydock.conf
ENTRYPOINT ["./entrypoint.sh"]
CMD ["server"]

12
entrypoint.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
CMD="drydock"
PORT="8000"
set -e
if [ "$1" = 'server' ]; then
exec uwsgi --http :${PORT} -w drydock_provisioner.drydock --callable drydock --enable-threads -L --pyargv "--config-file /etc/drydock/drydock.conf"
fi
exec ${CMD} $@

10
requirements-direct.txt Normal file
View File

@ -0,0 +1,10 @@
PyYAML
pyghmi>=1.0.18
netaddr
falcon
oslo.versionedobjects>=1.23.0
requests
oauthlib
uwsgi>1.4
bson===0.4.7
oslo.config

View File

@ -1,5 +0,0 @@
PyYAML==3.12
oauth==1.0.1
requests-oauthlib==0.8.0
netaddr==0.7.19
python-libmaas==0.4.1