forked from pulumi/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.fs
61 lines (53 loc) · 2.1 KB
/
Program.fs
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
module Program
open Pulumi
open Pulumi.FSharp
open Pulumi.Azure.ContainerService
open Pulumi.Azure.ContainerService.Inputs
open Pulumi.Azure.Core
open Pulumi.Docker
[<AutoOpen>]
module Helpers =
let inputLeft<'a, 'b>(v: 'a) : InputUnion<'a, 'b> = InputUnion.op_Implicit v
let infra () =
let resourceGroup = ResourceGroup "aci-rg"
let registry =
Registry("registry",
RegistryArgs
(ResourceGroupName = io resourceGroup.Name,
AdminEnabled = input true,
Sku = input "Premium"))
let imageName = registry.LoginServer |> Outputs.apply(fun v -> v + "/mynodeapp:v1.0.0") |> io
let dockerImage =
Image("node-app",
ImageArgs
(ImageName = imageName,
Build = inputLeft "./app",
Registry = input(
ImageRegistry
(Server = io registry.LoginServer,
Username = io registry.AdminUsername,
Password = io registry.AdminPassword))))
let group =
Group("aci",
GroupArgs
(ResourceGroupName = io resourceGroup.Name,
ImageRegistryCredentials = inputList [input
(GroupImageRegistryCredentialsArgs
(Server = io registry.LoginServer,
Username = io registry.AdminUsername,
Password = io registry.AdminPassword))],
OsType = input "Linux",
Containers = inputList [input
(GroupContainersArgs
(Cpu = input 0.5,
Image = io dockerImage.ImageName,
Memory = input 1.5,
Name = input "hello-world",
Ports = inputList [input (GroupContainersPortsArgs(Port = input 80, Protocol = input "TCP"))]
))],
IpAddressType = input "public",
DnsNameLabel = input "acifsharp"))
dict [("endpoint", group.Fqdn :> obj)]
[<EntryPoint>]
let main _ =
Deployment.run infra