This repository has been archived on 2023-05-06. You can view files and clone it, but cannot push or open issues or pull requests.
helix/internal/docker/image.go
2021-06-26 01:26:06 +01:00

34 lines
799 B
Go

package docker
import (
"fmt"
"github.com/pulumi/pulumi-docker/sdk/v3/go/docker"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// DockerImageConfig is the configuration
// used to create the local Gitea docker
// image.
type DockerImageConfig struct {
ImageName pulumi.StringInput
BuildContext pulumi.StringInput
Version pulumi.StringInput
}
// CreateDockerImage creates a local Docker image.
func CreateDockerImage(ctx *pulumi.Context, c DockerImageConfig) error {
args := docker.ImageArgs{
ImageName: c.ImageName,
SkipPush: pulumi.Bool(true),
Build: docker.DockerBuildArgs{
Context: c.BuildContext,
},
}
_, err := docker.NewImage(ctx, "gitea_image", &args)
if err != nil {
return fmt.Errorf("unable to create the Gitea docker image, %w", err)
}
return nil
}