← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~utlemming/cloud-init:utl/docker into cloud-init:master

 

Ben Howard has proposed merging ~utlemming/cloud-init:utl/docker into cloud-init:master.

Requested reviews:
  cloud init development team (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~utlemming/cloud-init/+git/cloud-init-1/+merge/321026

Added a Dockerfile and make targets for testing in Docker.

This allows for an easier developer expperience (i.e. Mac users) to do development and then run through tests locally via `make docker <target>`. 
-- 
Your team cloud init development team is requested to review the proposed merge of ~utlemming/cloud-init:utl/docker into cloud-init:master.
diff --git a/HACKING.rst b/HACKING.rst
index caee7ac..fa2816e 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -34,6 +34,12 @@ Do these things once
 .. _contributor-agreement-canonical: https://launchpad.net/%7Econtributor-agreement-canonical/+members
 .. _Launchpad git documentation: https://help.launchpad.net/Code/Git
 
+Optional Docker Build/Test
+==========================
+
+If you want to use a Docker "build/test" environment, an Dockerfile is in `tools/Dockerfile`. On a GNU system, you can generate the Docker Container by running `make docker_container`. After you have the container, you can run `make docker <target>` where target is defined in the Makefile.
+
+
 Do these things for each feature or bug
 =======================================
 
diff --git a/Makefile b/Makefile
index 5940ed7..207b49b 100644
--- a/Makefile
+++ b/Makefile
@@ -84,6 +84,12 @@ rpm:
 deb:
 	./packages/bddeb
 
+docker_container:
+	docker build -f tools/Dockerfile -t cloudinit-dev .
+
+docker:
+	docker run -t --rm -v $(CWD):/work cloudinit-dev $${2}
+
 .PHONY: test pyflakes pyflakes3 clean pep8 rpm deb yaml check_version
 .PHONY: pip-test-requirements pip-requirements clean_pyc unittest unittest3
 .PHONY: style-check
diff --git a/tools/Dockerfile b/tools/Dockerfile
new file mode 100644
index 0000000..ef081fe
--- /dev/null
+++ b/tools/Dockerfile
@@ -0,0 +1,54 @@
+FROM ubuntu:zesty
+
+VOLUME /work
+
+RUN apt-get -y update && \
+    apt-get -y dist-upgrade && \
+	apt-get install -y \
+            debhelper \
+            devscripts \
+            dh-systemd \
+            dpkg-dev \
+            pyflakes \
+            python \
+            python-coverage \
+            python-flake8 \
+            python-hacking \
+            python-httpretty \
+            python-jsonpatch \
+            python-mock \
+            python-nose \
+            python-pip \
+            python-pyflakes \
+            python-requests \
+            python-setuptools \
+            python-six \
+            python-unittest2 \
+            python-yaml \
+            python3 \
+            python3-coverage \
+            python3-flake8 \
+            python3-hacking \
+            python3-httpretty \
+            python3-jsonpatch \
+            python3-mock \
+            python3-nose \
+            python3-pip \
+            python3-pyflakes \
+            python3-requests \
+            python3-setuptools \
+            python3-six \
+            python3-unittest2 \
+            python3-yaml \
+            tox \
+            ubuntu-dev-tools
+
+COPY requirements.txt /tmp
+RUN /usr/bin/pip3 install -r /tmp/requirements.txt
+RUN /usr/bin/pip install -r /tmp/requirements.txt
+
+RUN apt-get -y clean
+
+WORKDIR /work
+ENTRYPOINT ["make"]
+CMD []

Follow ups