Merge branch 'joeyconfig'
This commit is contained in:
commit
40fc41b8c1
|
@ -2,6 +2,8 @@ propellor (2.5.0) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
* cmdProperty' renamed to cmdPropertyEnv to make way for a new,
|
* cmdProperty' renamed to cmdPropertyEnv to make way for a new,
|
||||||
more generic cmdProperty' (API change)
|
more generic cmdProperty' (API change)
|
||||||
|
* Add docker image related properties.
|
||||||
|
Thanks, Antoine Eiche.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Thu, 07 May 2015 12:08:34 -0400
|
-- Joey Hess <id@joeyh.name> Thu, 07 May 2015 12:08:34 -0400
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,14 @@ module Propellor.Property.Docker (
|
||||||
configured,
|
configured,
|
||||||
container,
|
container,
|
||||||
docked,
|
docked,
|
||||||
|
imageBuilt,
|
||||||
|
imagePulled,
|
||||||
memoryLimited,
|
memoryLimited,
|
||||||
garbageCollected,
|
garbageCollected,
|
||||||
tweaked,
|
tweaked,
|
||||||
Image,
|
Image,
|
||||||
ContainerName,
|
ContainerName,
|
||||||
Container,
|
Container(..),
|
||||||
-- * Container configuration
|
-- * Container configuration
|
||||||
dns,
|
dns,
|
||||||
hostname,
|
hostname,
|
||||||
|
@ -43,6 +45,7 @@ import Propellor.Types.Docker
|
||||||
import Propellor.Types.CmdLine
|
import Propellor.Types.CmdLine
|
||||||
import qualified Propellor.Property.File as File
|
import qualified Propellor.Property.File as File
|
||||||
import qualified Propellor.Property.Apt as Apt
|
import qualified Propellor.Property.Apt as Apt
|
||||||
|
import qualified Propellor.Property.Cmd as Cmd
|
||||||
import qualified Propellor.Shim as Shim
|
import qualified Propellor.Shim as Shim
|
||||||
import Utility.SafeCommand
|
import Utility.SafeCommand
|
||||||
import Utility.Path
|
import Utility.Path
|
||||||
|
@ -76,7 +79,10 @@ configured = prop `requires` installed
|
||||||
type ContainerName = String
|
type ContainerName = String
|
||||||
|
|
||||||
-- | A docker container.
|
-- | A docker container.
|
||||||
data Container = Container Image Host
|
data Container = Container
|
||||||
|
{ containerImage :: Image
|
||||||
|
, containerHost :: Host
|
||||||
|
}
|
||||||
|
|
||||||
instance PropAccum Container where
|
instance PropAccum Container where
|
||||||
(Container i h) & p = Container i (h & p)
|
(Container i h) & p = Container i (h & p)
|
||||||
|
@ -135,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 :: (IsProp (Property i)) => Container -> Property i -> Property HasInfo
|
||||||
propigateContainerInfo ctr@(Container _ h) p = propigateContainer ctr p'
|
propigateContainerInfo ctr@(Container _ h) p = propigateContainer ctr p'
|
||||||
where
|
where
|
||||||
|
|
Loading…
Reference in New Issue