35 lines
799 B
Go
35 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
|
||
|
}
|