Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
blaubaer committed Oct 11, 2024
1 parent 860bba7 commit 417c343
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 8 deletions.
38 changes: 30 additions & 8 deletions cmd/build/build-image.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,39 @@ func (this *buildImage) createPart(ctx context.Context, binary *buildArtifact) (

img = mutate.Annotations(img, annotations).(gcv1.Image)

configFile := this.defaultGenericConfigFile
if a.edition == editionExtended {
configFile = this.defaultExtendedConfigFile
artifacts := common.Seq2ErrOf[imageArtifactLayerItem](imageArtifactLayerItem{
sourceFile: this.defaultExtendedConfigFile,
targetFile: binary.platform.os.bifroestConfigFilePath(),
mode: 0644,
})
if !a.os.isUnix() {
artifacts = common.Seq2ErrOf[imageArtifactLayerItem](imageArtifactLayerItem{
sourceFile: this.defaultGenericConfigFile,
targetFile: binary.platform.os.bifroestConfigFilePath(),
mode: 0644,
})
} else if strings.EqualFold(from, "scratch") {
artifacts = common.Seq2ErrOf[imageArtifactLayerItem](imageArtifactLayerItem{
sourceFile: this.defaultGenericConfigFile,
targetFile: binary.platform.os.bifroestConfigFilePath(),
mode: 0644,
}, imageArtifactLayerItem{
sourceFile: "contrib/rootfs/etc/passwd",
targetFile: "/etc/passwd",
mode: 0644,
}, imageArtifactLayerItem{
sourceFile: "contrib/rootfs/etc/group",
targetFile: "/etc/group",
mode: 0644,
}, imageArtifactLayerItem{
sourceFile: "contrib/rootfs/etc/shadow",
targetFile: "/etc/shadow",
mode: 0600,
})
}

binaryLayer, err := binary.toLayer(common.JoinSeq2[imageArtifactLayerItem, error](
common.Seq2ErrOf[imageArtifactLayerItem](imageArtifactLayerItem{
sourceFile: configFile,
targetFile: binary.platform.os.bifroestConfigFilePath(),
mode: 0644,
}),
artifacts,
common.Seq2ErrOf[imageArtifactLayerItem](artifactDepItems...),
))
if err != nil {
Expand Down
9 changes: 9 additions & 0 deletions cmd/build/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ func (this os) execExt() string {
}
}

func (this os) isUnix() bool {
switch this {
case osLinux:
return true
default:
return false
}
}

func (this os) bifroestBinaryDirPath() string {
switch this {
case osWindows:
Expand Down
Empty file added contrib/rootfs/etc/group
Empty file.
Empty file added contrib/rootfs/etc/passwd
Empty file.
Empty file added contrib/rootfs/etc/shadow
Empty file.

0 comments on commit 417c343

Please sign in to comment.