Skip to content

Commit 9ce7e46

Browse files
committed
Docker: fix entrypoint failure if image has no build-plans (#531)
1 parent 5df922d commit 9ce7e46

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/Stack/Docker.hs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -717,13 +717,15 @@ entrypoint config@Config{..} DockerEntrypoint{..} = do
717717
-- its original home directory to the host's stack root, to avoid needing to download them
718718
origStackHomeDir <- parseAbsDir (User.homeDirectory ue)
719719
let origStackRoot = origStackHomeDir </> $(mkRelDir ("." ++ stackProgName))
720-
(_, buildPlans) <- listDirectory (buildPlanDir origStackRoot)
721-
forM_ buildPlans $ \srcBuildPlan -> do
722-
let destBuildPlan = buildPlanDir configStackRoot </> filename srcBuildPlan
723-
exists <- fileExists destBuildPlan
724-
unless exists $ do
725-
createTree (parent destBuildPlan)
726-
copyFile srcBuildPlan destBuildPlan
720+
buildPlanDirExists <- dirExists (buildPlanDir origStackRoot)
721+
when buildPlanDirExists $ do
722+
(_, buildPlans) <- listDirectory (buildPlanDir origStackRoot)
723+
forM_ buildPlans $ \srcBuildPlan -> do
724+
let destBuildPlan = buildPlanDir configStackRoot </> filename srcBuildPlan
725+
exists <- fileExists destBuildPlan
726+
unless exists $ do
727+
createTree (parent destBuildPlan)
728+
copyFile srcBuildPlan destBuildPlan
727729
forM_ configPackageIndices $ \pkgIdx -> do
728730
msrcIndex <- flip runReaderT (config{configStackRoot = origStackRoot}) $ do
729731
srcIndex <- configPackageIndex (indexName pkgIdx)

0 commit comments

Comments
 (0)