Merge branch 'fix/checkimages' into docker
This commit is contained in:
commit
a8e2fc1af3
1 changed files with 12 additions and 6 deletions
|
@ -40,13 +40,19 @@ data EvalResult
|
||||||
buildImage :: Language -> Myriad ()
|
buildImage :: Language -> Myriad ()
|
||||||
buildImage lang = do
|
buildImage lang = do
|
||||||
env <- ask
|
env <- ask
|
||||||
logInfo ["Building image ", cs $ imageName lang]
|
logInfo ["Checking for image ", cs $ imageName lang]
|
||||||
exec_ ["docker build -t ", imageName lang, " ", cs (env ^. #languagesDir) </> cs (lang ^. #name)]
|
res <- try $ exec ["docker images -q ", imageName lang]
|
||||||
setupQSems
|
case res of
|
||||||
logInfo ["Built image ", cs $ imageName lang]
|
Left (SomeException err) -> logError ["An exception occured when checking for image ", cs $ imageName lang, ":\n", cs $ show err]
|
||||||
when (env ^. #config % #prepareContainers) . void $ setupContainer lang
|
Right s -> do
|
||||||
|
when (BL.null s) . void $ do -- If string is empty that means the image does not yet exist
|
||||||
|
logInfo ["Building image ", cs $ imageName lang]
|
||||||
|
exec_ ["docker build -t ", imageName lang, " ", cs (env ^. #languagesDir) </> cs (lang ^. #name)]
|
||||||
|
logInfo ["Built image ", cs $ imageName lang]
|
||||||
|
setupQSems
|
||||||
|
when (env ^. #config % #prepareContainers) . void $ setupContainer lang
|
||||||
where
|
where
|
||||||
setupQSems :: Myriad ()
|
setupQSems :: Myriad ()
|
||||||
setupQSems = do
|
setupQSems = do
|
||||||
env <- ask
|
env <- ask
|
||||||
csem <- newQSem 1 -- We only want one container to be set up at a time
|
csem <- newQSem 1 -- We only want one container to be set up at a time
|
||||||
|
|
Loading…
Reference in a new issue