Compare commits
2 Commits
86d85f014c
...
1555419549
Author | SHA1 | Date | |
---|---|---|---|
|
1555419549 | ||
|
3f2cd997a0 |
@ -1 +1,3 @@
|
||||
Dockerfile
|
||||
tmp/**/*
|
||||
dist/*
|
||||
|
25
Dockerfile
Normal file
25
Dockerfile
Normal file
@ -0,0 +1,25 @@
|
||||
from golang:1.21.4-alpine3.18 as build
|
||||
|
||||
workdir /src
|
||||
copy go.mod go.sum .
|
||||
run go mod download
|
||||
|
||||
copy . .
|
||||
run go test ./...
|
||||
run go build -o /go/bin/init -trimpath .
|
||||
|
||||
# ------------------------------------------------------------------------
|
||||
from alpine:3.18.4
|
||||
|
||||
workdir /layer
|
||||
run wget -O- https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/x86_64/alpine-minirootfs-3.18.4-x86_64.tar.gz |tar zxv
|
||||
|
||||
run apk add --no-cache -p . musl lvm2 lvm2-dmeventd udev cryptsetup e2fsprogs btrfs-progs lsblk
|
||||
run rm -rf usr/share/apk var/cache/apk
|
||||
|
||||
copy --from=build /go/bin/init .
|
||||
|
||||
# check viability
|
||||
run chroot /layer /init hello
|
||||
|
||||
entrypoint ["sh","-c","find |cpio -H newc -o |base64"]
|
@ -1,12 +0,0 @@
|
||||
# ------------------------------------------------------------------------
|
||||
from alpine:3.15
|
||||
|
||||
add alpine-minirootfs-3.15.0-x86_64.tar.gz /layer/
|
||||
|
||||
workdir /layer
|
||||
|
||||
run apk update
|
||||
run apk add -p . musl lvm2 lvm2-dmeventd udev cryptsetup e2fsprogs btrfs-progs
|
||||
run rm -rf usr/share/apk var/cache/apk
|
||||
|
||||
entrypoint ["sh","-c","find |cpio -H newc -o |base64"]
|
Binary file not shown.
@ -147,7 +147,12 @@ func applyConfig(cfgPath string, bootMounted bool) (cfg *configV1) {
|
||||
log.Printf("failed to create dir %s: %v", filepath.Dir(fileDef.Path), err)
|
||||
}
|
||||
|
||||
err = os.WriteFile(filePath, []byte(fileDef.Content), fileDef.Mode)
|
||||
mode := fileDef.Mode
|
||||
if mode == 0 {
|
||||
mode = 0644
|
||||
}
|
||||
|
||||
err = os.WriteFile(filePath, []byte(fileDef.Content), mode)
|
||||
if err != nil {
|
||||
fatalf("failed to write %s: %v", fileDef.Path, err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user