Check if image exists before building
This commit is contained in:
parent
c186ecf521
commit
1b8c2eea8d
1 changed files with 12 additions and 6 deletions
|
@ -40,10 +40,16 @@ data EvalResult
|
||||||
buildImage :: Language -> Myriad ()
|
buildImage :: Language -> Myriad ()
|
||||||
buildImage lang = do
|
buildImage lang = do
|
||||||
env <- ask
|
env <- ask
|
||||||
|
logInfo ["Checking for image ", cs $ imageName lang]
|
||||||
|
res <- try $ exec ["docker images -q ", imageName lang]
|
||||||
|
case res of
|
||||||
|
Left (SomeException err) -> logError ["An exception occured when checking for image ", cs $ imageName lang, ":\n", cs $ show err]
|
||||||
|
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]
|
logInfo ["Building image ", cs $ imageName lang]
|
||||||
exec_ ["docker build -t ", imageName lang, " ", cs (env ^. #languagesDir) </> cs (lang ^. #name)]
|
exec_ ["docker build -t ", imageName lang, " ", cs (env ^. #languagesDir) </> cs (lang ^. #name)]
|
||||||
setupQSems
|
|
||||||
logInfo ["Built image ", cs $ imageName lang]
|
logInfo ["Built image ", cs $ imageName lang]
|
||||||
|
setupQSems
|
||||||
when (env ^. #config % #prepareContainers) . void $ setupContainer lang
|
when (env ^. #config % #prepareContainers) . void $ setupContainer lang
|
||||||
where
|
where
|
||||||
setupQSems :: Myriad ()
|
setupQSems :: Myriad ()
|
||||||
|
|
Loading…
Reference in a new issue