Dan Anglin
fda0d6a682
This commit adds the new containers stack which now builds the traefik docker image and creates the traefik docker container. Pulumi needed to be downgraded to version 3.2.1 because later versions panic when building the docker image.
24 lines
571 B
Go
24 lines
571 B
Go
package stacks
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"text/template"
|
|
)
|
|
|
|
// generateFile renders a given template to a given filepath.
|
|
func generateFile(data interface{}, templateString, templateName, path string) error {
|
|
file, err := os.Create(path)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to create the file '%s'...\n%v", path, err)
|
|
}
|
|
defer file.Close()
|
|
|
|
tmpl := template.Must(template.New(templateName).Parse(templateString))
|
|
|
|
if err = tmpl.Execute(file, data); err != nil {
|
|
return fmt.Errorf("unable to execute the template at '%s'...\n%v", path, err)
|
|
}
|
|
|
|
return nil
|
|
}
|