Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAT-590 incorrect docker image content #2376

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/Stack/Image.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ type Assemble e m = (HasConfig e, HasTerminal e, MonadBaseControl IO m, MonadIO
-- directory under '.stack-work'
stageContainerImageArtifacts
:: Build e m
=> Maybe (Path Abs Dir) -> m ()
stageContainerImageArtifacts mProjectRoot = do
=> Maybe (Path Abs Dir) -> [Text] -> m ()
stageContainerImageArtifacts mProjectRoot imageNames = do
config <- asks getConfig
forM_
(zip [0 ..] (imgDockers $ configImage config))
(zip
[0 ..]
(filterImages
(map T.unpack imageNames)
(imgDockers $ configImage config)))
(\(idx,opts) ->
do imageDir <-
imageStagingDir (fromMaybeProjectRoot mProjectRoot) idx
Expand Down Expand Up @@ -73,9 +77,11 @@ createContainerImageFromStage mProjectRoot imageNames = do
imageStagingDir (fromMaybeProjectRoot mProjectRoot) idx
createDockerImage opts imageDir
extendDockerImageWithEntrypoint opts imageDir)

filterImages :: [String] -> [ImageDockerOpts] -> [ImageDockerOpts]
filterImages [] = id -- all: no filter
filterImages names = filter (imageNameFound names . imgDockerImageName)
where
filterImages [] = id -- all: no filter
filterImages names = filter (imageNameFound names . imgDockerImageName)
imageNameFound names (Just name) = name `elem` names
imageNameFound _ _ = False

Expand Down
2 changes: 1 addition & 1 deletion src/main/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ imgDockerCmd (rebuild,images) go@GlobalOpts{..} = do
(const (return ()))
lk
defaultBuildOptsCLI
Image.stageContainerImageArtifacts mProjectRoot)
Image.stageContainerImageArtifacts mProjectRoot images)
(Just $ Image.createContainerImageFromStage mProjectRoot images)

-- | Load the configuration with a manager. Convenience function used
Expand Down