Separate lib and exe; add languageDir setting
This commit is contained in:
parent
abbce96d0a
commit
8eb44f2544
6 changed files with 38 additions and 16 deletions
|
@ -61,6 +61,7 @@ data MyriadConfig = MyriadConfig
|
|||
, prepareContainers :: Bool
|
||||
, cleanupInterval :: Natural
|
||||
, port :: Natural
|
||||
, languagesDir :: T.Text
|
||||
} deriving (Show, Generic)
|
||||
|
||||
instance Interpret MyriadConfig
|
||||
|
|
|
@ -20,17 +20,18 @@ import Control.Concurrent.Lifted (fork, threadDelay)
|
|||
import Control.Concurrent.MVar.Lifted
|
||||
import Control.Concurrent.QSem.Lifted
|
||||
import Control.Exception.Lifted
|
||||
import System.FilePath ((</>))
|
||||
import System.Process.Typed
|
||||
|
||||
import Myriad.Core
|
||||
|
||||
buildImage :: Myriadic m => LanguageConfig -> m ()
|
||||
buildImage lang@LanguageConfig { name, concurrent } = do
|
||||
MyriadConfig { prepareContainers, languagesDir } <- asks config
|
||||
logInfo ["Building image ", cs $ imageName lang]
|
||||
exec_ ["docker build -t ", imageName lang, " ./languages/", cs name]
|
||||
exec_ ["docker build -t ", imageName lang, " ", cs languagesDir </> cs name]
|
||||
setupQSems
|
||||
logInfo ["Built image ", cs $ imageName lang]
|
||||
MyriadConfig { prepareContainers } <- asks config
|
||||
when_ prepareContainers $ setupContainer lang
|
||||
where
|
||||
setupQSems :: Myriadic m => m ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue