@@ -260,8 +260,6 @@ runContainerAndExit getCmdArgs
260260 <*> hIsTerminalDevice stderr
261261 <*> (parseAbsDir =<< getHomeDirectory)
262262 isStdoutTerminal <- asks getTerminal
263- let sshDir = homeDir </> sshRelDir
264- sshDirExists <- doesDirExist sshDir
265263 let dockerHost = lookup " DOCKER_HOST" env
266264 dockerCertPath = lookup " DOCKER_CERT_PATH" env
267265 bamboo = lookup " bamboo_buildKey" env
@@ -309,6 +307,19 @@ runContainerAndExit getCmdArgs
309307 liftIO
310308 (do updateDockerImageLastUsed config iiId (toFilePath projectRoot)
311309 mapM_ (ensureDir) [sandboxHomeDir, stackRoot])
310+ -- Since $HOME is now mounted in the same place in the container we can
311+ -- just symlink $HOME/.ssh to the right place for the stack docker user
312+ let sshDir = homeDir </> sshRelDir
313+ sshDirExists <- doesDirExist sshDir
314+ sshSandboxDirExists <-
315+ liftIO
316+ (Files. fileExist
317+ (toFilePathNoTrailingSep (sandboxHomeDir </> sshRelDir)))
318+ when (sshDirExists && not sshSandboxDirExists)
319+ (liftIO
320+ (Files. createSymbolicLink
321+ (toFilePathNoTrailingSep sshDir)
322+ (toFilePathNoTrailingSep (sandboxHomeDir </> sshRelDir))))
312323 containerID <- (trim . decodeUtf8) <$> readDockerProcess
313324 envOverride
314325 (concat
@@ -320,17 +331,14 @@ runContainerAndExit getCmdArgs
320331 ," -e" ," HOME=" ++ toFilePathNoTrailingSep sandboxHomeDir
321332 ," -e" ," PATH=" ++ T. unpack newPathEnv
322333 ," -e" ," PWD=" ++ toFilePathNoTrailingSep pwd
334+ ," -v" ,toFilePathNoTrailingSep homeDir ++ " :" ++ toFilePathNoTrailingSep homeDir
323335 ," -v" ,toFilePathNoTrailingSep stackRoot ++ " :" ++ toFilePathNoTrailingSep stackRoot
324336 ," -v" ,toFilePathNoTrailingSep projectRoot ++ " :" ++ toFilePathNoTrailingSep projectRoot
325337 ," -v" ,toFilePathNoTrailingSep sandboxHomeDir ++ " :" ++ toFilePathNoTrailingSep sandboxHomeDir
326338 ," -w" ,toFilePathNoTrailingSep pwd]
327339 ,case muserEnv of
328340 Nothing -> []
329341 Just userEnv -> [" -e" ," USER=" ++ userEnv]
330- ,if sshDirExists
331- then [" -v" ,toFilePathNoTrailingSep sshDir ++ " :" ++
332- toFilePathNoTrailingSep (sandboxHomeDir </> sshRelDir)]
333- else []
334342 ,case msshAuthSock of
335343 Nothing -> []
336344 Just sshAuthSock ->
0 commit comments