code: func (mb *builder) Build(ctx context.Context) (distribution.Manifest, error) {
  	m := Manifest{
  		Versioned: SchemaVersion,
  		Layers:    make([]distribution.Descriptor, len(mb.dependencies)),
  	}
  	copy(m.Layers, mb.dependencies)
  
  	configDigest := digest.FromBytes(mb.configJSON)
  
  	var err error
  	m.Config, err = mb.bs.Stat(ctx, configDigest)
  	switch err {
  	case nil:
  		// Override MediaType, since Put always replaces the specified media
  		// type with application/octet-stream in the descriptor it returns.
  		m.Config.MediaType = mb.configMediaType
  		return FromStruct(m)
  	case distribution.ErrBlobUnknown:
  		// nop
  	default:
  		return nil, err
  	}
  
  	// Add config to the blob store
  	m.Config, err = mb.bs.Put(ctx, mb.configMediaType, mb.configJSON)
  	// Override MediaType, since Put always replaces the specified media
  	// type with application/octet-stream in the descriptor it returns.
  	m.Config.MediaType = mb.configMediaType
  	if err != nil {
  		return nil, err
  	}
  
  	return FromStruct(m)
  }
docs: // Build produces a final manifest from the given references.