@@ -101,6 +101,7 @@ const (
101101 dockerBuilderName = "fleet-server-builder"
102102 dockerImage = "docker.elastic.co/beats-ci/elastic-agent-cloud-fleet"
103103 dockerAgentImage = "fleet-server-e2e-agent"
104+ dockerFleetImage = "docker.elastic.co/observability-ci/fleet-server"
104105)
105106
106107// e2e test certs
@@ -997,7 +998,6 @@ func (Docker) Cover() error {
997998// VERSION_QUALIFIER may be used to manually specify a version qualifer for the image tag.
998999// DOCKER_IMAGE may be used to completely specify the image name.
9991000// DOCKER_IMAGE_TAG may be used to completely specify the image tag.
1000- // PLATFORMS may be used to specify multiplatform build targets. Defaults to [linux/amd64, linux/arm64].
10011001func (Docker ) Image () error {
10021002 dockerFile := "Dockerfile"
10031003 image := dockerImage
@@ -1014,12 +1014,50 @@ func (Docker) Image() error {
10141014 if v , ok := os .LookupEnv (envDockerImage ); ok && v != "" {
10151015 image = v
10161016 }
1017+
1018+ return sh .RunWithV (map [string ]string {"DOCKER_BUILDKIT" : "1" }, "docker" , "build" ,
1019+ "--build-arg" , "GO_VERSION=" + getGoVersion (),
1020+ "--build-arg" , "DEV=" + strconv .FormatBool (isDEV ()),
1021+ "--build-arg" , "FIPS=" + strconv .FormatBool (isFIPS ()),
1022+ "--build-arg" , "SNAPSHOT=" + strconv .FormatBool (isSnapshot ()),
1023+ "--build-arg" , "VERSION=" + getVersion (),
1024+ "--build-arg" , "GCFLAGS=" + getGCFlags (),
1025+ "--build-arg" , "LDFLAGS=" + getLDFlags (),
1026+ "-f" , dockerFile ,
1027+ "-t" , image + ":" + version ,
1028+ "." ,
1029+ )
1030+ }
1031+
1032+ // Publish creates a multiplatform images and pushes them to the registry.
1033+ // The name of the image is docker.elastic.co/observability-ci/fleet-server by default.
1034+ // FIPS creates a FIPS capable image, adds the -fips suffix to the image name.
1035+ // DEV creates a development image.
1036+ // SNAPSHOT creates a snapshot image.
1037+ // VERSION_QUALIFIER may be used to manually specify a version qualifer for the image tag.
1038+ // DOCKER_IMAGE may be used to completely specify the image name.
1039+ // DOCKER_IMAGE_TAG may be used to completely specify the image tag.
1040+ // PLATFORMS may be used to specify multiplatform build targets. Defaults to [linux/amd64, linux/arm64].
1041+ func (Docker ) Publish () error {
1042+ dockerFile := "Dockerfile"
1043+ image := dockerFleetImage
1044+ version := getVersion ()
1045+ if v , ok := os .LookupEnv (envDockerTag ); ok && v != "" {
1046+ version = v
1047+ }
1048+ if isFIPS () {
1049+ dockerFile = dockerBuilderFIPS
1050+ image += "-fips"
1051+ }
1052+ if v , ok := os .LookupEnv (envDockerImage ); ok && v != "" {
1053+ image = v
1054+ }
10171055 dockerEnv := map [string ]string {"DOCKER_BUILDKIT" : "1" }
10181056 if err := sh .RunWithV (dockerEnv , "docker" , "buildx" , "create" , "--use" ); err != nil {
10191057 return fmt .Errorf ("docker buildx create failed: %w" , err )
10201058 }
10211059
1022- return sh .RunWithV (dockerEnv , "docker" , "buildx" , "build" ,
1060+ return sh .RunWithV (dockerEnv , "docker" , "buildx" , "build" , "--push" ,
10231061 "--platform" , strings .Join (getDockerPlatforms (), "," ),
10241062 "--build-arg" , "GO_VERSION=" + getGoVersion (),
10251063 "--build-arg" , "DEV=" + strconv .FormatBool (isDEV ()),
@@ -1038,7 +1076,6 @@ func (Docker) Image() error {
10381076// FIPS may be used to push a FIPS capable image.
10391077// DOCKER_IMAGE may be used to specify the image name.
10401078// DOCKER_IMAGE_TAG may be used to specify the image tag.
1041- // PLATFORMS may be used to specify multiplatform build targets. Defaults to [linux/amd64, linux/arm64].
10421079func (Docker ) Push () error {
10431080 image := dockerImage
10441081 if isFIPS () {
@@ -1053,10 +1090,7 @@ func (Docker) Push() error {
10531090 version = v
10541091 }
10551092
1056- return sh .RunV ("docker" , "push" ,
1057- "--platform" , strings .Join (getDockerPlatforms (), "," ),
1058- image + ":" + version ,
1059- )
1093+ return sh .RunV ("docker" , "push" , image + ":" + version )
10601094}
10611095
10621096// CustomAgentImage creates a custom elastic-agent image where the fleet-server component has been replaced by one built locally.
0 commit comments