-- 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: -- --
-- 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 :: EDockerfileM a -> String untagged :: String -> EBaseImage tagged :: String -> String -> EBaseImage digested :: String -> ByteString -> EBaseImage ports :: [Integer] -> Ports port :: Integer -> Ports 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 => EDockerfileM a -> m () -- | A version of toDockerfile which allows IO actions toDockerfileIO :: MonadIO m => EDockerfileTM m t -> m Dockerfile -- | A version of toDockerfileStr which allows IO actions toDockerfileStrIO :: MonadIO m => EDockerfileTM m t -> m String -- | Just runs the EDSL's writer monad runDockerfileIO :: MonadIO m => EDockerfileTM m t -> m (t, Dockerfile) -- | Runs the EDSL's writer monad and pretty-prints the result runDockerfileStrIO :: MonadIO m => EDockerfileTM 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.Bash shellcheck :: String -> [Comment] 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 -- | 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 :: EDockerfileM a -> String -- | Runs the Dockerfile EDSL and returns a Dockerfile you can -- pretty print or manipulate toDockerfile :: EDockerfileM a -> Dockerfile -- | A version of toDockerfileStr which allows IO actions toDockerfileStrIO :: MonadIO m => EDockerfileTM m t -> m String -- | A version of toDockerfile which allows IO actions toDockerfileIO :: MonadIO m => EDockerfileTM m t -> m Dockerfile -- | Just runs the EDSL's writer monad runDockerfileIO :: MonadIO m => EDockerfileTM m t -> m (t, Dockerfile) -- | Runs the EDSL's writer monad and pretty-prints the result runDockerfileStrIO :: MonadIO m => EDockerfileTM m t -> m (t, String) -- | Lift a computation from the IO monad. liftIO :: MonadIO m => forall a. IO a -> m a from :: forall m_atIp. MonadFree EInstruction m_atIp => EBaseImage -> m_atIp () tagged :: String -> String -> EBaseImage untagged :: String -> EBaseImage digested :: String -> ByteString -> EBaseImage add :: forall m_atJ6. MonadFree EInstruction m_atJ6 => Source -> Destination -> m_atJ6 () user :: forall m_atJa. MonadFree EInstruction m_atJa => String -> m_atJa () label :: forall m_atJd. MonadFree EInstruction m_atJd => Pairs -> m_atJd () stopSignal :: forall m_atJg. MonadFree EInstruction m_atJg => String -> m_atJg () copy :: forall m_atJj. MonadFree EInstruction m_atJj => Source -> Destination -> m_atJj () run :: MonadFree EInstruction m => String -> m () runArgs :: forall m_atJn. MonadFree EInstruction m_atJn => Arguments -> m_atJn () cmd :: MonadFree EInstruction m => String -> m () cmdArgs :: forall m_atJq. MonadFree EInstruction m_atJq => Arguments -> m_atJq () workdir :: forall m_atJt. MonadFree EInstruction m_atJt => Directory -> m_atJt () expose :: forall m_atJw. MonadFree EInstruction m_atJw => Ports -> m_atJw () ports :: [Integer] -> Ports port :: Integer -> Ports volume :: forall m_atJz. MonadFree EInstruction m_atJz => String -> m_atJz () entrypoint :: MonadFree EInstruction m => String -> m () entrypointArgs :: forall m_atJC. MonadFree EInstruction m_atJC => Arguments -> m_atJC () maintainer :: forall m_atJF. MonadFree EInstruction m_atJF => String -> m_atJF () env :: forall m_atJI. MonadFree EInstruction m_atJI => Pairs -> m_atJI () arg :: forall m_atJL. MonadFree EInstruction m_atJL => String -> m_atJL () comment :: forall m_atJO. MonadFree EInstruction m_atJO => String -> m_atJO () -- | 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 => EDockerfileM a -> m () onBuildRaw :: forall m_atJR. MonadFree EInstruction m_atJR => Instruction -> m_atJR () embed :: forall m_atJU. MonadFree EInstruction m_atJU => [InstructionPos] -> m_atJU () -- | 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 -- | The type of Identity based EDSL blocks type EDockerfileM = Free EInstruction -- | The type of free monad EDSL blocks type EDockerfileTM = FreeT EInstruction 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 :: Ports -> 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 data Ports 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 module Language.Dockerfile.Predef appendLnIfMissing :: FilePath -> Text -> IO () dockerIgnore :: Text -> IO () addGlob :: (MonadIO m, MonadFree EInstruction m) => String -> Destination -> m () copyGlob :: (MonadIO m, MonadFree EInstruction m) => String -> Destination -> m () stackBuild :: (Monad m, MonadIO m, MonadFree EInstruction m) => m () stackBuild' :: (Monad m, MonadIO m, MonadFree EInstruction m) => String -> m () -> m () nodejs :: (Monad m, MonadIO m, MonadFree EInstruction m) => m () nodejs' :: (Monad m, MonadIO m, MonadFree EInstruction m) => String -> m () -> m ()