From 3790a65dd5e1558ffe5a89577788f68288570d3a Mon Sep 17 00:00:00 2001 From: Antoine Eiche Date: Mon, 11 May 2015 12:56:01 +0200 Subject: add Docker.Container field labels containerImage and containerHost --- src/Propellor/Property/Docker.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs index 6ca5005c..d04ed4bf 100644 --- a/src/Propellor/Property/Docker.hs +++ b/src/Propellor/Property/Docker.hs @@ -16,7 +16,7 @@ module Propellor.Property.Docker ( tweaked, Image, ContainerName, - Container, + Container(..), -- * Container configuration dns, hostname, @@ -76,7 +76,10 @@ configured = prop `requires` installed type ContainerName = String -- | A docker container. -data Container = Container Image Host +data Container = Container + { containerImage :: Image + , containerHost :: Host + } instance PropAccum Container where (Container i h) & p = Container i (h & p) -- cgit v1.2.3 From c83c68115f1e56e64ba46ddcb4e82454764bc39d Mon Sep 17 00:00:00 2001 From: Antoine Eiche Date: Mon, 11 May 2015 00:00:00 +0200 Subject: Docker images related properties. - a property to pull image from standard Docker Hub registry. - a property to build image from a local directory (with a Dockerfile). --- src/Propellor/Property/Docker.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs index d04ed4bf..745b5622 100644 --- a/src/Propellor/Property/Docker.hs +++ b/src/Propellor/Property/Docker.hs @@ -11,6 +11,8 @@ module Propellor.Property.Docker ( configured, container, docked, + imageBuilt, + imagePulled, memoryLimited, garbageCollected, tweaked, @@ -43,6 +45,7 @@ import Propellor.Types.Docker import Propellor.Types.CmdLine import qualified Propellor.Property.File as File import qualified Propellor.Property.Apt as Apt +import qualified Propellor.Property.Cmd as Cmd import qualified Propellor.Shim as Shim import Utility.SafeCommand import Utility.Path @@ -138,6 +141,21 @@ docked ctr@(Container _ h) = ] ] +-- | Build the image from a directory containing a Dockerfile. +imageBuilt :: FilePath -> Image -> Property NoInfo +imageBuilt directory image = describe built msg + where + msg = "docker image " ++ image ++ " built from " ++ directory + built = Cmd.cmdProperty' dockercmd ["build", "--tag", image, "./"] workDir + workDir p = p { cwd = Just directory } + +-- | Pull the image from the standard Docker Hub registry. +imagePulled :: Image -> Property NoInfo +imagePulled image = describe pulled msg + where + msg = "docker image " ++ image ++ " pulled" + pulled = Cmd.cmdProperty dockercmd ["pull", image] + propigateContainerInfo :: (IsProp (Property i)) => Container -> Property i -> Property HasInfo propigateContainerInfo ctr@(Container _ h) p = propigateContainer ctr p' where -- cgit v1.2.3 From 04d04fe9174563fef2276fc66235074ac2a3392f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 12 May 2015 11:06:45 -0400 Subject: changelog --- debian/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/changelog b/debian/changelog index 37d31938..dc3b09de 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ propellor (2.5.0) UNRELEASED; urgency=medium * cmdProperty' renamed to cmdPropertyEnv to make way for a new, more generic cmdProperty' (API change) + * Add docker image related properties. + Thanks, Antoine Eiche. -- Joey Hess Thu, 07 May 2015 12:08:34 -0400 -- cgit v1.2.3