Add example for Go with Docker
ADD
azure-go-aci/Gopkg.toml
+# Gopkg.toml example
+#
+# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
+# for detailed Gopkg.toml documentation.
+#
+# required = ["github.com/user/thing/cmd/thing"]
+# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
+#
+# [[constraint]]
+# name = "github.com/user/project"
+# version = "1.0.0"
+#
+# [[constraint]]
+# name = "github.com/user/project2"
+# branch = "dev"
+# source = "github.com/myfork/project2"
+#
+# [[override]]
+# name = "github.com/x/y"
+# version = "2.4.0"
+#
+# [prune]
+# non-go = false
+# go-tests = true
+# unused-packages = true
+
+[[constraint]]
+ name = "github.com/pulumi/pulumi"
+ revision = "b6e5d2737d4fb454d748f0022ea29f9c4a0686fc"
+
+[[constraint]]
+ name = "github.com/pulumi/pulumi-docker"
+ revision = "88e4d81f3ddf417d3468251affff2f55c56c1a5e"
+
+[prune]
+ go-tests = true
+ unused-packages = true

ADD
azure-go-aci/Pulumi.yaml
+name: azure-go-aci
+description: Deploys a docker container to Azure Container Instances
+runtime: go

ADD
azure-go-aci/app/Dockerfile
+FROM nginx
+COPY content /usr/share/nginx/html

ADD
azure-go-aci/app/content/favicon.png
azure-go-aci/app/content/favicon.png
Binary files /dev/null and b/azure-go-aci/app/content/favicon.png differ

ADD
azure-go-aci/main.go
+package main
+
+import (
+ "github.com/pulumi/pulumi-azure/sdk/go/azure/containerservice"
+ "github.com/pulumi/pulumi-azure/sdk/go/azure/core"
+ "github.com/pulumi/pulumi-docker/sdk/go/docker"
+ "github.com/pulumi/pulumi/sdk/go/pulumi"
+)
+
+func main() {
+ pulumi.Run(func(ctx *pulumi.Context) error {
+ // Create a resource group.
+ resourceGroup, err := core.NewResourceGroup(ctx, "aci-rg", nil)
+ if err != nil {
+ return err
+ }
+
+ // Create a registry.
+ registryArgs := containerservice.RegistryArgs{
+ ResourceGroupName: resourceGroup.Name,
+ AdminEnabled: pulumi.Bool(true),
+ Sku: pulumi.String("Premium"),
+ }
+ registry, err := containerservice.NewRegistry(ctx, "registry", &registryArgs)
+ if err != nil {
+ return err
+ }
+
+ // Create the docker image.
+ imageArgs := docker.ImageArgs{
+ ImageName: pulumi.Sprintf("%s/mynodeapp:v1.0.0", registry.LoginServer),
+ Build: &docker.DockerBuildArgs{
+ Context: pulumi.String("./app"),
+ },
+ Registry: &docker.ImageRegistryArgs{
+ Server: registry.LoginServer,
+ Username: registry.AdminUsername,
+ Password: registry.AdminPassword,
+ },
+ }
+ image, err := docker.NewImage(ctx, "node-app", &imageArgs)
+ if err != nil {
+ return err
+ }
+
+ // Create a group.
+ credentialArgs := containerservice.GroupImageRegistryCredentialArgs{
+ Server: registry.LoginServer,
+ Username: registry.AdminUsername,
+ Password: registry.AdminPassword,
+ }
+ portArgs := containerservice.GroupContainerPortArgs{
+ Port: pulumi.Int(80),
+ Protocol: pulumi.String("TCP"),
+ }
+ containerArgs := containerservice.GroupContainerArgs{
+ Cpu: pulumi.Float64(0.5),
+ Image: image.ImageName,
+ Memory: pulumi.Float64(1.5),
+ Name: pulumi.String("hello-world"),
+ Ports: containerservice.GroupContainerPortArray{portArgs},
+ }
+ groupArgs := containerservice.GroupArgs{
+ ResourceGroupName: resourceGroup.Name,
+ ImageRegistryCredentials: containerservice.GroupImageRegistryCredentialArray{credentialArgs},
+ OsType: pulumi.String("Linux"),
+ Containers: containerservice.GroupContainerArray{containerArgs},
+ IpAddressType: pulumi.String("public"),
+ DnsNameLabel: pulumi.String("acigo"),
+ }
+ group, err := containerservice.NewGroup(ctx, "aci", &groupArgs)
+ if err != nil {
+ return err
+ }
+
+ ctx.Export("endpoint", group.Fqdn)
+ return nil
+ })
+}

Add example for Go with Docker (#594)