-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
83 lines (65 loc) · 1.82 KB
/
build.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#r "paket: groupref netcorebuild //"
#load ".fake/build.fsx/intellisense.fsx"
#if !FAKE
#r "Facades/netstandard"
#r "netstandard"
#endif
#nowarn "52"
open System
open Fake.Core
open Fake.Core.TargetOperators
open Fake.DotNet
open Fake.IO
open Fake.IO.Globbing.Operators
open Fake.IO.FileSystemOperators
open Fake.Tools.Git
open Fake.JavaScript
let deployDir = "./deploy" |> Path.getFullName
let staticDir = "./static/assets" |> Path.getFullName
let dockerUser = "evelina"
let dockerOrg = "turinginst"
let dockerImageName = "twitcher"
let localConfig = staticDir + "/api-config.yaml"
Target.create "Clean" (fun _ ->
!! "src/bin"
++ "src/obj"
++ "output"
|> Seq.iter Shell.cleanDir
)
Target.create "DotnetRestore" (fun _ ->
DotNet.restore
(DotNet.Options.withWorkingDirectory __SOURCE_DIRECTORY__)
"twitcher.sln"
)
Target.create "YarnInstall" (fun _ ->
Yarn.install id
)
Target.create "Build" (fun _ ->
// download API config yaml file
let configFile = "https://raw.githubusercontent.com/alan-turing-institute/dodo/master/config.yml"
let wc = new System.Net.WebClient()
wc.DownloadFile(configFile, localConfig)
Yarn.exec "webpack" id
)
Target.create "Watch" (fun _ ->
Yarn.exec "webpack-dev-server" id
)
Target.create "DockerBuild" (fun _ ->
// let result =
// DotNet.exec
// (DotNet.Options.withWorkingDirectory __SOURCE_DIRECTORY__)
// "fable"
// "webpack --port free -- -p"
Fake.IO.Shell.copyRecursive "output" deployDir true |> ignore
// if not result.OK then failwithf "dotnet fable failed with code %i" result.ExitCode
)
// Build order
"Clean"
==> "DotnetRestore"
==> "YarnInstall"
==> "Build"
==> "DockerBuild"
"Watch"
<== [ "YarnInstall" ]
// start build
Target.runOrDefault "DockerBuild"