module Hadolint.Rule.DL3067 (rule) where import Hadolint.Rule import Language.Docker.Syntax rule :: Rule args rule :: forall args. Rule args rule = RuleCode -> DLSeverity -> Text -> (Instruction args -> Bool) -> Rule args forall args. RuleCode -> DLSeverity -> Text -> (Instruction args -> Bool) -> Rule args simpleRule RuleCode code DLSeverity severity Text message Instruction args -> Bool forall {args}. Instruction args -> Bool check where code :: RuleCode code = RuleCode "DL3067" severity :: DLSeverity severity = DLSeverity DLWarningC message :: Text message = Text "Do not copy an entire filesystem from another stage" check :: Instruction args -> Bool check (Copy (CopyArgs NonEmpty SourcePath sources TargetPath target) (CopyFlags Chown _ Chmod _ Link _ Parents _ (CopySource Text _) [Exclude] _)) = Bool -> Bool not (Bool -> Bool) -> Bool -> Bool forall a b. (a -> b) -> a -> b $ (SourcePath -> Bool) -> NonEmpty SourcePath -> Bool forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool any SourcePath -> Bool isRootSource NonEmpty SourcePath sources Bool -> Bool -> Bool && TargetPath -> Bool isRootTarget TargetPath target check Instruction args _ = Bool True {-# INLINEABLE rule #-} isRootSource :: SourcePath -> Bool isRootSource :: SourcePath -> Bool isRootSource (SourcePath Text source) = Text -> Text dropQuotes Text source Text -> Text -> Bool forall a. Eq a => a -> a -> Bool == Text "/" isRootTarget :: TargetPath -> Bool isRootTarget :: TargetPath -> Bool isRootTarget (TargetPath Text target) = Text -> Text dropQuotes Text target Text -> Text -> Bool forall a. Eq a => a -> a -> Bool == Text "/"