align with OCI artifact best practices

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2023-10-23 15:50:34 +02:00 committed by Nicolas De loof
parent 6ab41d629f
commit 39008c539c
1 changed files with 6 additions and 0 deletions

View File

@ -20,6 +20,8 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"os" "os"
"path/filepath"
"time"
"github.com/compose-spec/compose-go/types" "github.com/compose-spec/compose-go/types"
"github.com/distribution/reference" "github.com/distribution/reference"
@ -72,6 +74,7 @@ func (s *composeService) publish(ctx context.Context, project *types.Project, re
Size: int64(len(f)), Size: int64(len(f)),
Annotations: map[string]string{ Annotations: map[string]string{
"com.docker.compose.version": api.ComposeVersion, "com.docker.compose.version": api.ComposeVersion,
"com.docker.compose.file": filepath.Base(file),
}, },
} }
layers = append(layers, layer) layers = append(layers, layer)
@ -114,6 +117,9 @@ func (s *composeService) publish(ctx context.Context, project *types.Project, re
ArtifactType: "application/vnd.docker.compose.project", ArtifactType: "application/vnd.docker.compose.project",
Config: configDescriptor, Config: configDescriptor,
Layers: layers, Layers: layers,
Annotations: map[string]string{
"org.opencontainers.image.created": time.Now().Format(time.RFC3339),
},
}) })
if err != nil { if err != nil {
return err return err