better build
This commit is contained in:
parent
86d85f014c
commit
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.
Loading…
Reference in New Issue
Block a user