services/magefiles/deploy.go
Dan Anglin dd339eb3d6
fix: template updates and code fixes
This commit comes after provisioning the development environment.

Changes:

- templates: template the container name.
- mage: update the deploy target to deploy to specific environments.
- compose: fix network ref.
- traefik: merge all dynamic templates into one file.
- woodpecker(dockerfile): remove commands to copy entrypoint to the
  docker container since the entrypoint has been removed.
- traefik: add support for using existing TLS certificates.
2023-08-28 04:04:40 +01:00

43 lines
741 B
Go

//go:build mage
package main
import (
"fmt"
"os"
"github.com/magefile/mage/mg"
"github.com/magefile/mage/sh"
)
// Deploy deploys the services to the Flow Platform.
func Deploy(environment, name string) error {
os.Setenv("MAGEFILE_VERBOSE", "true")
mg.Deps(
mg.F(Prepare, environment, name),
)
cfg, err := newConfig(environment)
if err != nil {
return fmt.Errorf("unable to load the configuration; %w", err)
}
os.Setenv("DOCKER_HOST", cfg.Docker.Host)
command := []string{
"docker",
"compose",
"--project-directory",
fmt.Sprintf("%s/%s/compose", rootBuildDir, environment),
"up",
"-d",
"--build",
}
if name != "all" {
command = append(command, name)
}
return sh.Run(command[0], command[1:]...)
}