rework Dockerfiles to depend on xosproject/xos-base
diff --git a/containers/synchronizer/Dockerfile b/containers/synchronizer/Dockerfile
index c4bb737..2f1e092 100644
--- a/containers/synchronizer/Dockerfile
+++ b/containers/synchronizer/Dockerfile
@@ -1,47 +1,5 @@
FROM xosproject/xos
-RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
- openssh-client \
- python-crypto \
- python-jinja2 \
- python-paramiko \
- python-yaml \
- python-httplib2 \
- rsync \
- supervisor
-
-RUN pip install -U \
- jinja2
-
-# Install custom Ansible
-RUN \
- git clone -b release1.8.2 git://github.com/ansible/ansible.git /opt/ansible && \
- git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/lib/ansible/modules/extras && \
- git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/v2/ansible/modules/extras && \
- git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/lib/ansible/modules/core && \
- git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/v2/ansible/modules/core && \
- # git clone uses cached copy, doesn't pick up latest
- git -C /opt/ansible pull && \
- git -C /opt/ansible/lib/ansible/modules/core pull && \
- git -C /opt/ansible/v2/ansible/modules/core pull
-
-
-# For Observer
-RUN mkdir -p /usr/local/share /bin /etc/ansible
-
-COPY conf/ansible-hosts /etc/ansible/hosts
-
-ADD http://phantomjs.googlecode.com/files/phantomjs-1.7.0-linux-x86_64.tar.bz2 /usr/local/share/
-
-RUN git clone git://git.planet-lab.org/fofum.git /tmp/fofum && \
- cd /tmp/fofum; python setup.py install && \
- rm -rf /tmp/fofum && \
- tar jxvf /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2 -C /usr/local/share/ && \
- rm -f /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2 && \
- ln -s /usr/local/share/phantomjs-1.7.0-linux-x86_64 /usr/local/share/phantomjs && \
- ln -s /usr/local/share/phantomjs/bin/phantomjs /bin/phantomjs
-
-
# Supervisor
COPY conf/synchronizer.conf /etc/supervisor/conf.d/
diff --git a/containers/xos/Dockerfile b/containers/xos/Dockerfile
index e631e23..958d8ae 100644
--- a/containers/xos/Dockerfile
+++ b/containers/xos/Dockerfile
@@ -1,88 +1,18 @@
-FROM ubuntu:14.04.3
-
-# XXX Workaround for docker bug:
-# https://github.com/docker/docker/issues/6345
-# Kernel 3.15 breaks docker, uss the line below as a workaround
-# until there is a fix
-RUN ln -s -f /bin/true /usr/bin/chfn
-# XXX End workaround
-
-# Install.
-RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
- curl \
- gcc \
- geoip-database \
- git \
- graphviz \
- graphviz-dev \
- libgeoip1 \
- libxslt1.1 \
- libxslt1-dev \
- libyaml-dev \
- m4 \
- pkg-config \
- python-dev \
- python-httplib2 \
- python-pip \
- python-psycopg2 \
- python-pycurl \
- python-setuptools \
- tar \
- wget \
-##### observer dependencies
- python-keystoneclient \
- python-novaclient \
- python-neutronclient \
- python-glanceclient \
- python-ceilometerclient
-
-RUN pip install \
- django==1.7 \
- django-bitfield \
- django-crispy-forms \
- django-encrypted-fields \
- django-extensions \
- django-filter==0.11.0 \
- django-geoposition \
- django-ipware \
- django_rest_swagger \
- django-suit==0.3a1 \
- django-timezones \
- djangorestframework==3.3.3 \
- dnslib \
- jinja2 \
- lxml \
- markdown \
- netaddr \
- pyOpenSSL \
- psycopg2 \
- python-ceilometerclient \
- python-dateutil \
- python-keyczar \
- python-logstash \
- pygraphviz \
- pytz \
- pyyaml \
- requests
-
-RUN easy_install --upgrade httplib2
-
-RUN easy_install \
- python_gflags \
- google_api_python_client \
- httplib2.ca_certs_locater
-
-ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/dist-packages/suit/static/suit/js/
+FROM xosproject/xos-base
# Include certificates from Openstack
ADD local_certs.crt /usr/local/share/ca-certificates/local_certs.crt
RUN update-ca-certificates
# Install XOS
-RUN git clone git://github.com/open-cloud/xos.git /tmp/xos && \
- mv /tmp/xos/xos /opt/ && \
- chmod +x /opt/xos/tools/xos-manage && \
- /opt/xos/tools/xos-manage genkeys
+ENV XOS_GIT_REPO git://github.com/open-cloud/xos.git
+ENV XOS_GIT_BRANCH master
+
+RUN git clone $XOS_GIT_REPO -b $XOS_GIT_BRANCH /tmp/xos && \
+ mv /tmp/xos/xos /opt/
+
+RUN chmod +x /opt/xos/tools/xos-manage
+RUN /opt/xos/tools/xos-manage genkeys
# install Tosca engine
RUN chmod +x /opt/xos/tosca/run.py
@@ -90,11 +20,12 @@
EXPOSE 8000
-# Set environment variables.
+# Set environment variables
ENV HOME /root
-# Define working directory.
+# Define working directory
WORKDIR /opt/xos
-# Define default command.
+# Define default command
CMD python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure --makemigrations
+
diff --git a/containers/xos/Dockerfile.devel b/containers/xos/Dockerfile.devel
index 2b796e4..470c338 100644
--- a/containers/xos/Dockerfile.devel
+++ b/containers/xos/Dockerfile.devel
@@ -1,78 +1,4 @@
-FROM ubuntu:14.04.3
-
-# XXX Workaround for docker bug:
-# https://github.com/docker/docker/issues/6345
-# Kernel 3.15 breaks docker, uss the line below as a workaround
-# until there is a fix
-RUN ln -s -f /bin/true /usr/bin/chfn
-# XXX End workaround
-
-# Install.
-RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
- curl \
- gcc \
- geoip-database \
- git \
- graphviz \
- graphviz-dev \
- libgeoip1 \
- libxslt1.1 \
- libxslt1-dev \
- libyaml-dev \
- m4 \
- pkg-config \
- python-dev \
- python-httplib2 \
- python-pip \
- python-psycopg2 \
- python-pycurl \
- python-setuptools \
- tar \
- wget \
-##### observer dependencies
- python-keystoneclient \
- python-novaclient \
- python-neutronclient \
- python-glanceclient \
- python-ceilometerclient
-
-RUN pip install \
- django==1.7 \
- django-bitfield \
- django-crispy-forms \
- django-encrypted-fields \
- django-extensions \
- django-filter==0.11.0 \
- django-geoposition \
- django-ipware \
- django_rest_swagger \
- django-suit==0.3a1 \
- django-timezones \
- djangorestframework==3.3.3 \
- dnslib \
- jinja2 \
- lxml \
- markdown \
- netaddr \
- pyOpenSSL \
- psycopg2 \
- python-ceilometerclient \
- python-dateutil \
- python-keyczar \
- python-logstash \
- pygraphviz \
- pytz \
- pyyaml \
- requests
-
-RUN easy_install --upgrade httplib2
-
-RUN easy_install \
- python_gflags \
- google_api_python_client \
- httplib2.ca_certs_locater
-
-ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/dist-packages/suit/static/suit/js/
+FROM xosproject/xos-base
# Include certificates from Openstack
ADD containers/xos/local_certs.crt /usr/local/share/ca-certificates/local_certs.crt
@@ -80,6 +6,7 @@
# Install XOS
ADD xos /opt/xos
+
RUN chmod +x /opt/xos/tools/xos-manage
RUN /opt/xos/tools/xos-manage genkeys
@@ -89,11 +16,12 @@
EXPOSE 8000
-# Set environment variables.
+# Set environment variables
ENV HOME /root
-# Define working directory.
+# Define working directory
WORKDIR /opt/xos
-# Define default command.
+# Define default command
CMD python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure --makemigrations
+
diff --git a/containers/xos/Dockerfile.templ b/containers/xos/Dockerfile.templ
deleted file mode 100644
index 95592c6..0000000
--- a/containers/xos/Dockerfile.templ
+++ /dev/null
@@ -1,93 +0,0 @@
-FROM ubuntu:14.04.3
-
-# XXX Workaround for docker bug:
-# https://github.com/docker/docker/issues/6345
-# Kernel 3.15 breaks docker, uss the line below as a workaround
-# until there is a fix
-RUN ln -s -f /bin/true /usr/bin/chfn
-# XXX End workaround
-
-# Install.
-RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
- curl \
- gcc \
- geoip-database \
- git \
- graphviz \
- graphviz-dev \
- libgeoip1 \
- libxslt1.1 \
- libxslt1-dev \
- libyaml-dev \
- m4 \
- pkg-config \
- python-dev \
- python-httplib2 \
- python-pip \
- python-psycopg2 \
- python-pycurl \
- python-setuptools \
- tar \
- wget \
-##### observer dependencies
- python-keystoneclient \
- python-novaclient \
- python-neutronclient \
- python-glanceclient \
- python-ceilometerclient
-
-RUN pip install -U \
- django==1.7 \
- django-bitfield \
- django-crispy-forms \
- django-encrypted-fields \
- django_evolution \
- django-extensions \
- django-filter==0.11.0 \
- django-geoposition \
- django-ipware \
- django_rest_swagger \
- django-suit==0.3a1 \
- django-timezones \
- djangorestframework==3.3.3 \
- dnslib \
- google_api_python_client \
- httplib2 \
- httplib2.ca_certs_locater \
- lxml \
- markdown \
- netaddr \
- python-dateutil \
- python_gflags \
- python-keyczar \
- python-logstash \
- pygraphviz \
- pytz \
- pyyaml \
- requests
-
-ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/dist-packages/suit/static/suit/js/
-
-# Include certificates from Openstack
-ADD containers/xos/local_certs.crt /usr/local/share/ca-certificates/local_certs.crt
-RUN update-ca-certificates
-
-# Install XOS
-RUN git clone XOS_GIT_REPO -b XOS_GIT_BRANCH /tmp/xos && \
- mv /tmp/xos/xos /opt/ && \
- chmod +x /opt/xos/tools/xos-manage && \
- /opt/xos/tools/xos-manage genkeys
-
-# install Tosca engine
-RUN bash /opt/xos/tosca/install_tosca.sh
-
-EXPOSE 8000
-
-# Set environment variables.
-ENV HOME /root
-
-# Define working directory.
-WORKDIR /root
-
-# Define default command.
-CMD python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure --makemigrations
diff --git a/containers/xos/Makefile b/containers/xos/Makefile
index cf91988..23b4445 100644
--- a/containers/xos/Makefile
+++ b/containers/xos/Makefile
@@ -1,30 +1,63 @@
-CONTAINER_NAME:=xos-server
-IMAGE_NAME:=xosproject/xos
-TOSCA_CONFIG_PATH:=/opt/xos/configurations/opencloud/opencloud.yaml
-XOS_GIT_REPO?=git://github.com/open-cloud/xos.git
-XOS_GIT_BRANCH?=master
-NO_DOCKER_CACHE?=false
+# Docker container Makefile for XOS
+#
+# Targets:
+#
+# `base` - XOS prerequistie files, no XOS code, builds xosproject/xos-base
+# `build` - base + XOS code, git pulled in Dockerfile from main repo,
+# builds xosproject/xos
+# `custom` - base + XOS code, git pulled in Dockerfile from selectable repo,
+# builds xosproject/xos
+# `devel` - base + XOS code from local directory, builds xosproject/xos
+# `test` - xosproject/xos + nodejs testing frameworks, builds
+# xosproject/xos-test
+#
-.PHONY: build
-build: ; sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm -t ${IMAGE_NAME} .
+NO_DOCKER_CACHE ?= false
-.PHONY: custom
-custom: ; cat Dockerfile.templ | sed -e "s|XOS_GIT_REPO|${XOS_GIT_REPO}|g" -e "s|XOS_GIT_BRANCH|${XOS_GIT_BRANCH}|g" | docker build --no-cache=${NO_DOCKER_CACHE} --rm -t ${IMAGE_NAME} -
+CONTAINER_NAME ?= xos-server
+IMAGE_NAME ?= xosproject/xos
-.PHONY: devel
-devel: ; cd ../..; ls; sudo docker build -f containers/xos/Dockerfile.devel --no-cache=${NO_DOCKER_CACHE} --rm -t ${IMAGE_NAME} .
+XOS_GIT_REPO ?= git://github.com/open-cloud/xos.git
+XOS_GIT_BRANCH ?= master
-.PHONY: test
-test: ; cd ../..; ls; sudo docker build -f containers/xos/Dockerfile.test --no-cache=${NO_DOCKER_CACHE} --rm -t ${IMAGE_NAME} .
+TOSCA_CONFIG_PATH ?= /opt/xos/configurations/opencloud/opencloud.yaml
-.PHONY: run
-run: ; sudo docker run -d --name ${CONTAINER_NAME} -p 80:8000 -v /usr/local/share/ca-certificates:/usr/local/share/ca-certificates:ro ${IMAGE_NAME}
+base:
+ sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm \
+ -f Dockerfile.base -t xosproject/xos-base .
-.PHONY: runtosca
-runtosca: ; sudo docker exec -it ${CONTAINER_NAME} /usr/bin/python /opt/xos/tosca/run.py padmin@vicci.org ${TOSCA_CONFIG_PATH}
+build:
+ sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm \
+ -f Dockerfile -t ${IMAGE_NAME} .
-.PHONY: stop
-stop: ; sudo docker stop ${CONTAINER_NAME}
+custom:
+ docker build --no-cache=${NO_DOCKER_CACHE} --rm \
+ --build-arg XOS_GIT_REPO=${XOS_GIT_REPO} \
+ --build-arg XOS_GIT_BRANCH=${XOS_GIT_BRANCH} \
+ -f Dockerfile -t ${IMAGE_NAME} .
-.PHONY: rm
-rm: ; sudo docker rm ${CONTAINER_NAME}
+devel:
+ sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm \
+ -f containers/xos/Dockerfile.devel -t ${IMAGE_NAME} ../..
+
+test:
+ sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm \
+ -f containers/xos/Dockerfile.test -t xosproject/xos-test ../..
+
+run:
+ sudo docker run -d --name ${CONTAINER_NAME} -p 80:8000 \
+ ${IMAGE_NAME}
+
+runtosca:
+ sudo docker exec -it ${CONTAINER_NAME} \
+ /usr/bin/python /opt/xos/tosca/run.py padmin@vicci.org ${TOSCA_CONFIG_PATH}
+
+stop:
+ sudo docker stop ${CONTAINER_NAME}
+
+rm:
+ sudo docker rm ${CONTAINER_NAME}
+
+rmi:
+ sudo docker rmi `docker images | grep "^<none>" | awk '{print $$3}'`
+