-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Dockerfile linter, parser, pretty-printer and embedded DSL
--
-- Forked from hadolint.
--
-- All functions for parsing, printing and writting Dockerfiles are
-- exported through Language.Dockerfile. For more fine-grained
-- operations look for specific modules that implement a certain
-- functionality.
--
-- There are two flags in this package, which enable building two
-- executables:
--
--
-- - hadolint Enables building the hadolint
-- executable, though you might prefer to use the hadolint package
-- directly
-- - dockerfmt Builds example pretty-printer usage, which
-- reads a Dockerfile and pretty-prints it to stdout
--
--
-- See the GitHub project for the source-code and examples.
@package language-dockerfile
@version 0.3.2.0
module Language.Dockerfile.Bash
shellcheck :: String -> [Comment]
module Language.Dockerfile.Normalize
-- | Remove new line escapes and join escaped lines together on one line to
-- simplify parsing later on. Escapes are replaced with line breaks to
-- not alter the line numbers.
normalizeEscapedLines :: String -> String
module Language.Dockerfile.Lexer
lexer :: TokenParser ()
reserved :: String -> Parser ()
reservedOp :: String -> Parser ()
natural :: Parser Integer
commaSep :: ParsecT String () Identity a -> ParsecT String () Identity [a]
stringLiteral :: ParsecT String () Identity String
brackets :: ParsecT String () Identity a -> ParsecT String () Identity a
identifier :: ParsecT String () Identity String
lexeme :: ParsecT String () Identity a -> ParsecT String () Identity a
module Language.Dockerfile.Syntax
type Image = String
type Tag = String
type Port = Integer
type Directory = String
data BaseImage
UntaggedImage :: Image -> BaseImage
TaggedImage :: Image -> Tag -> BaseImage
DigestedImage :: Image -> ByteString -> BaseImage
-- | Type of the Dockerfile AST
type Dockerfile = [InstructionPos]
type Source = String
type Destination = String
type Arguments = [String]
type Pairs = [(String, String)]
-- | All commands available in Dockerfiles
data Instruction
From :: BaseImage -> Instruction
Add :: Source -> Destination -> Instruction
User :: String -> Instruction
Label :: Pairs -> Instruction
Stopsignal :: String -> Instruction
Copy :: Source -> Destination -> Instruction
Run :: Arguments -> Instruction
Cmd :: Arguments -> Instruction
Workdir :: Directory -> Instruction
Expose :: [Port] -> Instruction
Volume :: String -> Instruction
Entrypoint :: Arguments -> Instruction
Maintainer :: String -> Instruction
Env :: Pairs -> Instruction
Arg :: String -> Instruction
Comment :: String -> Instruction
OnBuild :: Instruction -> Instruction
EOL :: Instruction
type Filename = String
type Linenumber = Int
-- | Instruction with additional location information required for
-- creating good check messages
data InstructionPos
InstructionPos :: Instruction -> Filename -> Linenumber -> InstructionPos
instruction :: InstructionPos -> Instruction
sourcename :: InstructionPos -> Filename
instance GHC.Show.Show Language.Dockerfile.Syntax.InstructionPos
instance GHC.Classes.Ord Language.Dockerfile.Syntax.InstructionPos
instance GHC.Classes.Eq Language.Dockerfile.Syntax.InstructionPos
instance GHC.Show.Show Language.Dockerfile.Syntax.Instruction
instance GHC.Classes.Ord Language.Dockerfile.Syntax.Instruction
instance GHC.Classes.Eq Language.Dockerfile.Syntax.Instruction
instance GHC.Show.Show Language.Dockerfile.Syntax.BaseImage
instance GHC.Classes.Ord Language.Dockerfile.Syntax.BaseImage
instance GHC.Classes.Eq Language.Dockerfile.Syntax.BaseImage
module Language.Dockerfile.Rules
data Metadata
Metadata :: String -> Severity -> String -> Metadata
[code] :: Metadata -> String
[severity] :: Metadata -> Severity
[message] :: Metadata -> String
data Check
Check :: Metadata -> Filename -> Linenumber -> Bool -> Check
[metadata] :: Check -> Metadata
[filename] :: Check -> Filename
[linenumber] :: Check -> Linenumber
[success] :: Check -> Bool
link :: Metadata -> String
type Rule = Dockerfile -> [Check]
mapInstructions :: Metadata -> (Instruction -> Bool) -> Rule
instructionRule :: String -> Severity -> String -> (Instruction -> Bool) -> Rule
dockerfileRule :: String -> Severity -> String -> ([Instruction] -> Bool) -> Rule
analyze :: [Rule] -> Dockerfile -> [Check]
rules :: [Rule]
commentMetadata :: Comment -> Metadata
shellcheckBash :: Dockerfile -> [Check]
bashCommands :: [String] -> [[String]]
absoluteWorkdir :: Rule
hasMaintainer :: Rule
usingProgram :: String -> [String] -> Bool
multipleCmds :: Rule
multipleEntrypoints :: Rule
wgetOrCurl :: Rule
invalidCmd :: Rule
noRootUser :: Rule
noCd :: Rule
noSudo :: Rule
noUpgrade :: Rule
noUntagged :: Rule
noLatestTag :: Rule
aptGetVersionPinned :: Rule
aptGetPackages :: [String] -> [String]
aptGetCleanup :: Rule
useAdd :: Rule
invalidPort :: Rule
maintainerAddress :: Rule
pipVersionPinned :: Rule
isAptGetInstall :: [[Char]] -> Bool
aptGetYes :: Rule
aptGetNoRecommends :: Rule
isArchive :: String -> Bool
isUrl :: String -> Bool
copyInsteadAdd :: Rule
instance GHC.Classes.Eq Language.Dockerfile.Rules.Check
instance GHC.Classes.Eq Language.Dockerfile.Rules.Metadata
instance GHC.Classes.Ord Language.Dockerfile.Rules.Check
module Language.Dockerfile.FormatCheck
formatCheck :: Check -> String
module Language.Dockerfile.Syntax.Lift
instance Language.Haskell.TH.Syntax.Lift Language.Dockerfile.Syntax.InstructionPos
instance Language.Haskell.TH.Syntax.Lift Language.Dockerfile.Syntax.Instruction
instance Language.Haskell.TH.Syntax.Lift Language.Dockerfile.Syntax.BaseImage
module Language.Dockerfile.Parser
comment :: Parser Instruction
taggedImage :: Parser BaseImage
digestedImage :: Parser BaseImage
untaggedImage :: Parser BaseImage
baseImage :: Parser BaseImage
from :: Parser Instruction
cmd :: Parser Instruction
copy :: Parser Instruction
stopsignal :: Parser Instruction
quotedValue :: Parser String
rawValue :: Parser String
singleValue :: Parser String
pair :: Parser (String, String)
pairs :: Parser Pairs
remainingPairs :: Parser Pairs
label :: Parser Instruction
arg :: Parser Instruction
env :: Parser Instruction
user :: Parser Instruction
add :: Parser Instruction
expose :: Parser Instruction
run :: Parser Instruction
untilEol :: Parser String
untilOccurrence :: String -> Parser String
workdir :: Parser Instruction
volume :: Parser Instruction
maintainer :: Parser Instruction
argumentsExec :: Parser Arguments
argumentsShell :: Parser Arguments
arguments :: Parser Arguments
entrypoint :: Parser Instruction
onbuild :: Parser Instruction
eolInstruction :: Parser Instruction
parseInstruction :: Parser Instruction
contents :: Parser a -> Parser a
eol :: Parser ()
dockerfile :: Parser Dockerfile
parseString :: String -> Either ParseError Dockerfile
parseFile :: String -> IO (Either ParseError Dockerfile)
module Language.Dockerfile.PrettyPrint
-- | Pretty print a Dockerfile to a String
prettyPrint :: Dockerfile -> String
-- | Pretty print a InstructionPos to a String
prettyPrintInstructionPos :: InstructionPos -> String
prettyPrintBaseImage :: BaseImage -> Doc
prettyPrintPairs :: Pairs -> Doc
prettyPrintPair :: (String, String) -> Doc
prettyPrintArguments :: Arguments -> Doc
prettyPrintInstruction :: Instruction -> Doc
module Language.Dockerfile.EDSL.Types
data EBaseImage
EUntaggedImage :: String -> EBaseImage
ETaggedImage :: String -> String -> EBaseImage
EDigestedImage :: String -> ByteString -> EBaseImage
data EInstruction next
From :: EBaseImage -> next -> EInstruction next
Add :: Source -> Destination -> next -> EInstruction next
User :: String -> next -> EInstruction next
Label :: Pairs -> next -> EInstruction next
StopSignal :: String -> next -> EInstruction next
Copy :: Source -> Destination -> next -> EInstruction next
RunArgs :: Arguments -> next -> EInstruction next
CmdArgs :: Arguments -> next -> EInstruction next
Workdir :: Directory -> next -> EInstruction next
Expose :: [Port] -> next -> EInstruction next
Volume :: String -> next -> EInstruction next
EntrypointArgs :: Arguments -> next -> EInstruction next
Maintainer :: String -> next -> EInstruction next
Env :: Pairs -> next -> EInstruction next
Arg :: String -> next -> EInstruction next
Comment :: String -> next -> EInstruction next
OnBuildRaw :: Instruction -> next -> EInstruction next
Embed :: [InstructionPos] -> next -> EInstruction next
instance GHC.Base.Functor Language.Dockerfile.EDSL.Types.EInstruction
instance GHC.Classes.Ord Language.Dockerfile.EDSL.Types.EBaseImage
instance GHC.Classes.Eq Language.Dockerfile.EDSL.Types.EBaseImage
instance GHC.Show.Show Language.Dockerfile.EDSL.Types.EBaseImage
instance Data.String.IsString Language.Dockerfile.EDSL.Types.EBaseImage
module Language.Dockerfile.EDSL
type EInstructionM = Free EInstruction
type EInstructionTM = FreeT EInstruction
embed :: forall m_ayOb. MonadFree EInstruction m_ayOb => [InstructionPos] -> m_ayOb ()
onBuildRaw :: forall m_ayO8. MonadFree EInstruction m_ayO8 => Instruction -> m_ayO8 ()
comment :: forall m_ayO5. MonadFree EInstruction m_ayO5 => String -> m_ayO5 ()
arg :: forall m_ayO2. MonadFree EInstruction m_ayO2 => String -> m_ayO2 ()
env :: forall m_ayNZ. MonadFree EInstruction m_ayNZ => Pairs -> m_ayNZ ()
maintainer :: forall m_ayNW. MonadFree EInstruction m_ayNW => String -> m_ayNW ()
entrypointArgs :: forall m_ayNT. MonadFree EInstruction m_ayNT => Arguments -> m_ayNT ()
volume :: forall m_ayNQ. MonadFree EInstruction m_ayNQ => String -> m_ayNQ ()
expose :: forall m_ayNN. MonadFree EInstruction m_ayNN => [Port] -> m_ayNN ()
workdir :: forall m_ayNK. MonadFree EInstruction m_ayNK => Directory -> m_ayNK ()
cmdArgs :: forall m_ayNH. MonadFree EInstruction m_ayNH => Arguments -> m_ayNH ()
runArgs :: forall m_ayNE. MonadFree EInstruction m_ayNE => Arguments -> m_ayNE ()
copy :: forall m_ayNA. MonadFree EInstruction m_ayNA => Source -> Destination -> m_ayNA ()
stopSignal :: forall m_ayNx. MonadFree EInstruction m_ayNx => String -> m_ayNx ()
label :: forall m_ayNu. MonadFree EInstruction m_ayNu => Pairs -> m_ayNu ()
user :: forall m_ayNr. MonadFree EInstruction m_ayNr => String -> m_ayNr ()
add :: forall m_ayNn. MonadFree EInstruction m_ayNn => Source -> Destination -> m_ayNn ()
from :: forall m_ayMG. MonadFree EInstruction m_ayMG => EBaseImage -> m_ayMG ()
runDockerWriter :: (MonadWriter [Instruction] m) => EInstructionM a -> m a
runDockerWriterIO :: (Monad m, MonadTrans t, Monad (t m), MonadWriter [Instruction] (t m), MonadIO (t m)) => EInstructionTM 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
instructionPos :: Instruction -> InstructionPos
-- | Runs the Dockerfile EDSL and returns a Dockerfile you can
-- pretty print or manipulate
toDockerfile :: EInstructionM a -> Dockerfile
-- | runs the Dockerfile EDSL and returns a String using
-- PrettyPrint
--
--
-- import Language.Dockerfile
--
-- main :: IO ()
-- main = writeFile "something.dockerfile" $ toDockerfileStr $ do
-- from (tagged "fpco/stack-build" "lts-6.9")
-- add "." "applanguage-dockerfile"
-- workdir "applanguage-dockerfile"
-- run (words "stack build --test --only-dependencies")
-- cmd (words "stack test")
--
toDockerfileStr :: EInstructionM a -> String
untagged :: String -> EBaseImage
tagged :: String -> String -> EBaseImage
digested :: String -> ByteString -> EBaseImage
run :: MonadFree EInstruction m => String -> m ()
entrypoint :: MonadFree EInstruction m => String -> m ()
cmd :: MonadFree EInstruction m => String -> 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"
--
onBuild :: MonadFree EInstruction m => EInstructionM a -> m ()
-- | A version of toDockerfile which allows IO actions
toDockerfileIO :: MonadIO m => EInstructionTM m t -> m Dockerfile
-- | A version of toDockerfileStr which allows IO actions
toDockerfileStrIO :: MonadIO m => EInstructionTM m t -> m String
-- | Just runs the EDSL's writer monad
runDockerfileIO :: MonadIO m => EInstructionTM m t -> m (t, Dockerfile)
-- | Runs the EDSL's writer monad and pretty-prints the result
runDockerfileStrIO :: MonadIO m => EInstructionTM m t -> m (t, String)
module Language.Dockerfile.EDSL.Quasi
-- | Quasiquoter for embedding dockerfiles on the EDSL
--
--
-- putStr $ toDockerfile $ do
-- from "node"
-- run "apt-get update"
-- [edockerfile|
-- RUN apt-get update
-- CMD node something.js
-- |]
--
edockerfile :: QuasiQuoter
edockerfileE :: String -> ExpQ
dockerfile :: QuasiQuoter
dockerfileE :: String -> ExpQ
filterEOL :: [InstructionPos] -> [InstructionPos]
module Language.Dockerfile
-- | Type of the Dockerfile AST
type Dockerfile = [InstructionPos]
parseString :: String -> Either ParseError Dockerfile
parseFile :: String -> IO (Either ParseError Dockerfile)
-- | Pretty print a Dockerfile to a String
prettyPrint :: Dockerfile -> String
-- | Pretty print a InstructionPos to a String
prettyPrintInstructionPos :: InstructionPos -> String
-- | runs the Dockerfile EDSL and returns a String using
-- PrettyPrint
--
--
-- import Language.Dockerfile
--
-- main :: IO ()
-- main = writeFile "something.dockerfile" $ toDockerfileStr $ do
-- from (tagged "fpco/stack-build" "lts-6.9")
-- add "." "applanguage-dockerfile"
-- workdir "applanguage-dockerfile"
-- run (words "stack build --test --only-dependencies")
-- cmd (words "stack test")
--
toDockerfileStr :: EInstructionM a -> String
-- | Runs the Dockerfile EDSL and returns a Dockerfile you can
-- pretty print or manipulate
toDockerfile :: EInstructionM a -> Dockerfile
-- | A version of toDockerfileStr which allows IO actions
toDockerfileStrIO :: MonadIO m => EInstructionTM m t -> m String
-- | A version of toDockerfile which allows IO actions
toDockerfileIO :: MonadIO m => EInstructionTM m t -> m Dockerfile
-- | Just runs the EDSL's writer monad
runDockerfileIO :: MonadIO m => EInstructionTM m t -> m (t, Dockerfile)
-- | Runs the EDSL's writer monad and pretty-prints the result
runDockerfileStrIO :: MonadIO m => EInstructionTM m t -> m (t, String)
-- | Lift a computation from the IO monad.
liftIO :: MonadIO m => forall a. IO a -> m a
from :: forall m_ayMG. MonadFree EInstruction m_ayMG => EBaseImage -> m_ayMG ()
tagged :: String -> String -> EBaseImage
untagged :: String -> EBaseImage
digested :: String -> ByteString -> EBaseImage
add :: forall m_ayNn. MonadFree EInstruction m_ayNn => Source -> Destination -> m_ayNn ()
user :: forall m_ayNr. MonadFree EInstruction m_ayNr => String -> m_ayNr ()
label :: forall m_ayNu. MonadFree EInstruction m_ayNu => Pairs -> m_ayNu ()
stopSignal :: forall m_ayNx. MonadFree EInstruction m_ayNx => String -> m_ayNx ()
copy :: forall m_ayNA. MonadFree EInstruction m_ayNA => Source -> Destination -> m_ayNA ()
run :: MonadFree EInstruction m => String -> m ()
runArgs :: forall m_ayNE. MonadFree EInstruction m_ayNE => Arguments -> m_ayNE ()
cmd :: MonadFree EInstruction m => String -> m ()
cmdArgs :: forall m_ayNH. MonadFree EInstruction m_ayNH => Arguments -> m_ayNH ()
workdir :: forall m_ayNK. MonadFree EInstruction m_ayNK => Directory -> m_ayNK ()
expose :: forall m_ayNN. MonadFree EInstruction m_ayNN => [Port] -> m_ayNN ()
volume :: forall m_ayNQ. MonadFree EInstruction m_ayNQ => String -> m_ayNQ ()
entrypoint :: MonadFree EInstruction m => String -> m ()
entrypointArgs :: forall m_ayNT. MonadFree EInstruction m_ayNT => Arguments -> m_ayNT ()
maintainer :: forall m_ayNW. MonadFree EInstruction m_ayNW => String -> m_ayNW ()
env :: forall m_ayNZ. MonadFree EInstruction m_ayNZ => Pairs -> m_ayNZ ()
arg :: forall m_ayO2. MonadFree EInstruction m_ayO2 => String -> m_ayO2 ()
comment :: forall m_ayO5. MonadFree EInstruction m_ayO5 => String -> m_ayO5 ()
-- | 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"
--
onBuild :: MonadFree EInstruction m => EInstructionM a -> m ()
onBuildRaw :: forall m_ayO8. MonadFree EInstruction m_ayO8 => Instruction -> m_ayO8 ()
embed :: forall m_ayOb. MonadFree EInstruction m_ayOb => [InstructionPos] -> m_ayOb ()
-- | Quasiquoter for embedding dockerfiles on the EDSL
--
--
-- putStr $ toDockerfile $ do
-- from "node"
-- run "apt-get update"
-- [edockerfile|
-- RUN apt-get update
-- CMD node something.js
-- |]
--
edockerfile :: QuasiQuoter
data EBaseImage
EUntaggedImage :: String -> EBaseImage
ETaggedImage :: String -> String -> EBaseImage
EDigestedImage :: String -> ByteString -> EBaseImage
dockerfile :: QuasiQuoter
-- | All commands available in Dockerfiles
data Instruction
From :: BaseImage -> Instruction
Add :: Source -> Destination -> Instruction
User :: String -> Instruction
Label :: Pairs -> Instruction
Stopsignal :: String -> Instruction
Copy :: Source -> Destination -> Instruction
Run :: Arguments -> Instruction
Cmd :: Arguments -> Instruction
Workdir :: Directory -> Instruction
Expose :: [Port] -> Instruction
Volume :: String -> Instruction
Entrypoint :: Arguments -> Instruction
Maintainer :: String -> Instruction
Env :: Pairs -> Instruction
Arg :: String -> Instruction
Comment :: String -> Instruction
OnBuild :: Instruction -> Instruction
EOL :: Instruction
-- | Instruction with additional location information required for
-- creating good check messages
data InstructionPos
InstructionPos :: Instruction -> Filename -> Linenumber -> InstructionPos
data BaseImage
UntaggedImage :: Image -> BaseImage
TaggedImage :: Image -> Tag -> BaseImage
DigestedImage :: Image -> ByteString -> BaseImage
type Image = String
type Tag = String
type Port = Integer
type Directory = String
type Source = String
type Destination = String
type Arguments = [String]
type Pairs = [(String, String)]
type Filename = String
type Linenumber = Int
-- | The abstract data type ParseError represents parse errors. It
-- provides the source position (SourcePos) of the error and a
-- list of error messages (Message). A ParseError can be
-- returned by the function parse. ParseError is an
-- instance of the Show and Eq classes.
data ParseError :: *
instruction :: InstructionPos -> Instruction
instructionPos :: Instruction -> InstructionPos
sourcename :: InstructionPos -> Filename