language-docker-2.0.1: Dockerfile parser, pretty-printer and embedded DSL

Safe HaskellNone
LanguageHaskell2010

Language.Docker.EDSL

Synopsis

Documentation

type EDockerfileM = Free EInstruction #

The type of Identity based EDSL blocks

type EDockerfileTM = FreeT EInstruction #

The type of free monad EDSL blocks

embed :: forall m. MonadFree EInstruction m => [InstructionPos] -> m () #

onBuildRaw :: forall m. MonadFree EInstruction m => Instruction -> m () #

healthcheck :: forall m. MonadFree EInstruction m => Check -> m () #

comment :: forall m. MonadFree EInstruction m => String -> m () #

arg :: forall m. MonadFree EInstruction m => String -> Maybe String -> m () #

env :: forall m. MonadFree EInstruction m => Pairs -> m () #

maintainer :: forall m. MonadFree EInstruction m => String -> m () #

entrypointArgs :: forall m. MonadFree EInstruction m => Arguments -> m () #

volume :: forall m. MonadFree EInstruction m => String -> m () #

expose :: forall m. MonadFree EInstruction m => Ports -> m () #

workdir :: forall m. MonadFree EInstruction m => Directory -> m () #

shell :: forall m. MonadFree EInstruction m => Arguments -> m () #

cmdArgs :: forall m. MonadFree EInstruction m => Arguments -> m () #

runArgs :: forall m. MonadFree EInstruction m => Arguments -> m () #

stopSignal :: forall m. MonadFree EInstruction m => String -> m () #

label :: forall m. MonadFree EInstruction m => Pairs -> m () #

user :: forall m. MonadFree EInstruction m => String -> m () #

from :: forall m. MonadFree EInstruction m => EBaseImage -> m () #

runDockerWriterIO :: (Monad m, MonadTrans t, Monad (t m), MonadWriter [Instruction] (t m), MonadIO (t m)) => EDockerfileTM m a -> t m a #

runDef :: MonadWriter [t] m => (t1 -> t) -> t1 -> m b -> m b #

runDef2 :: MonadWriter [t] m => (t1 -> t2 -> t) -> t1 -> t2 -> m b -> m b #

runD :: MonadWriter [Instruction] m => EInstruction (m b) -> m b #

toDockerfile :: EDockerfileM a -> Dockerfile #

Runs the Dockerfile EDSL and returns a Dockerfile you can pretty print or manipulate

toDockerfileStr :: EDockerfileM a -> String #

runs the Dockerfile EDSL and returns a String using PrettyPrint

import           Language.Docker

main :: IO ()
main = writeFile "something.dockerfile" $ toDockerfileStr $ do
    from (tagged "fpco/stack-build" "lts-6.9")
    add ["."] "applanguage-docker"
    workdir "applanguage-docker"
    run (words "stack build --test --only-dependencies")
    cmd (words "stack test")

ports :: [Port] -> Ports #

onBuild :: MonadFree EInstruction m => EDockerfileM a -> m () #

ONBUILD Dockerfile instruction

Each nested instruction gets emitted as a separate ONBUILD block

toDockerfile $ do
    from "node"
    run "apt-get update"
    onBuild $ do
        run "echo more-stuff"
        run "echo here"

toDockerfileIO :: MonadIO m => EDockerfileTM m t -> m Dockerfile #

A version of toDockerfile which allows IO actions

toDockerfileStrIO :: MonadIO m => EDockerfileTM m t -> m String #

A version of toDockerfileStr which allows IO actions

runDockerfileIO :: MonadIO m => EDockerfileTM m t -> m (t, Dockerfile) #

Just runs the EDSL's writer monad

runDockerfileStrIO :: MonadIO m => EDockerfileTM m t -> m (t, String) #

Runs the EDSL's writer monad and pretty-prints the result