diff --git a/internal/project/auto/config.go b/internal/project/auto/config.go index 7ff20c6..6284f88 100644 --- a/internal/project/auto/config.go +++ b/internal/project/auto/config.go @@ -37,3 +37,6 @@ type CustomStep struct { type CI struct { Provider string `yaml:"provider"` } + +// CustomStepsGenerate defines custom steps that run before the build. +type CustomStepsGenerate = CustomSteps diff --git a/internal/project/golang/generate.go b/internal/project/golang/generate.go index 28f08b9..3234898 100644 --- a/internal/project/golang/generate.go +++ b/internal/project/golang/generate.go @@ -42,12 +42,19 @@ type Generate struct { GoGenerateSpecs []GoGenerateSpec `yaml:"goGenerateSpecs"` ExperimentalFlags []string `yaml:"experimentalFlags"` + Files []File `yaml:"files"` VTProtobufEnabled bool `yaml:"vtProtobufEnabled"` VersionPackagePath string `yaml:"versionPackagePath"` } +// File represents a file to be fetched/copied into the image. +type File struct { + Source string `yaml:"source"` + Destination string `yaml:"destination"` +} + // ProtoSpec describes a set of protobuf specs to be compiled. type ProtoSpec struct { Source string `yaml:"source"` @@ -165,6 +172,10 @@ func (generate *Generate) CompileDockerfile(output *dockerfile.Output) error { Description("cleaned up specs and compiled versions"). From("scratch") + for _, file := range generate.Files { + generateStage.Step(step.Add(file.Source, file.Destination)) + } + if len(generate.Specs) > 0 { specs := output.Stage("proto-specs"). Description("collects proto specs").