fix build issue
This commit is contained in:
1
BUILD.sh
1
BUILD.sh
@@ -81,6 +81,7 @@ docker build \
|
|||||||
--builder bearcloud \
|
--builder bearcloud \
|
||||||
--allow security.insecure \
|
--allow security.insecure \
|
||||||
-f vm.Dockerfile \
|
-f vm.Dockerfile \
|
||||||
|
--build-context host-modules=/lib/modules \
|
||||||
--target export \
|
--target export \
|
||||||
--output type=local,dest=./data \
|
--output type=local,dest=./data \
|
||||||
$VM_OPTS .
|
$VM_OPTS .
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ services:
|
|||||||
- "./test.sh:/test.sh"
|
- "./test.sh:/test.sh"
|
||||||
devices:
|
devices:
|
||||||
- "/dev/kvm:/dev/kvm"
|
- "/dev/kvm:/dev/kvm"
|
||||||
|
- "/dev/net/tun:/dev/net/tun"
|
||||||
entrypoint: ["/sbin/tini", "/test.sh"]
|
entrypoint: ["/sbin/tini", "/test.sh"]
|
||||||
cap_add:
|
cap_add:
|
||||||
- CAP_SYS_ADMIN
|
- CAP_SYS_ADMIN
|
||||||
|
- CAP_NET_ADMIN
|
||||||
tty: true
|
tty: true
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ CONFIGURE_SH="${SCRIPT_DIR}/configure.sh"
|
|||||||
|
|
||||||
TMP=$(mktemp)
|
TMP=$(mktemp)
|
||||||
|
|
||||||
|
modprobe nbd max_parts=8 && [ -e /dev/nbd0 ] || mknod /dev/nbd0 b 43 0
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
rm $TMP
|
rm $TMP
|
||||||
}
|
}
|
||||||
@@ -29,7 +31,7 @@ alpine-make-vm-image \
|
|||||||
--fs-skel-dir "$OVERLAY_DIR" \
|
--fs-skel-dir "$OVERLAY_DIR" \
|
||||||
--fs-skel-chown root:root \
|
--fs-skel-chown root:root \
|
||||||
--script-chroot \
|
--script-chroot \
|
||||||
--packages "git curl docker cronie" \
|
--packages "git curl docker cronie dhclient" \
|
||||||
"$IMAGE_FILE" \
|
"$IMAGE_FILE" \
|
||||||
"$CONFIGURE_SH" | tee $TMP
|
"$CONFIGURE_SH" | tee $TMP
|
||||||
|
|
||||||
|
|||||||
1
test.sh
1
test.sh
@@ -8,4 +8,5 @@ set -euo pipefail
|
|||||||
--cmdline "modules=ext4 root=/dev/vda rootfstype=ext4 rw console=hvc0" \
|
--cmdline "modules=ext4 root=/dev/vda rootfstype=ext4 rw console=hvc0" \
|
||||||
--cpus boot=${CPU_COUNT:-4} \
|
--cpus boot=${CPU_COUNT:-4} \
|
||||||
--memory size=${MEMORY:-4G},shared=on \
|
--memory size=${MEMORY:-4G},shared=on \
|
||||||
|
--net "tap=,mac=,ip=,mask="
|
||||||
$@
|
$@
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
FROM golang:1.25-alpine AS bubble-builder
|
FROM golang:1.25-alpine AS bubble-builder
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
RUN apk add git && git clone https://github.com/iceBear67/bubble && go mod download && mkdir /build
|
RUN apk add git && git clone https://github.com/iceBear67/bubble . && go mod download && mkdir /build
|
||||||
RUN CGO_ENABLED=0 go build -o /build/daemon . && \
|
RUN CGO_ENABLED=0 go build -o /build/daemon . && \
|
||||||
CGO_ENABLED=0 go build -o /build/auth_server ./util/
|
CGO_ENABLED=0 go build -o /build/auth_server ./util/
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
ARG TARGETOS
|
|
||||||
ARG TARGETARCH
|
|
||||||
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
|
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
|
||||||
go build -o /build/daemon . && \
|
go build -o /build/daemon . && \
|
||||||
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
|
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
|
||||||
@@ -26,6 +22,8 @@ RUN sed -i "s#_REPO_#$CLOUD_CONFIG_REPO#g" /kitchen/overlay/daemon/update-keys.s
|
|||||||
COPY --from=bubble-builder /build/daemon /bin/bubble
|
COPY --from=bubble-builder /build/daemon /bin/bubble
|
||||||
COPY --from=bubble-builder /build/auth_server /bin/auth-server
|
COPY --from=bubble-builder /build/auth_server /bin/auth-server
|
||||||
RUN --security=insecure \
|
RUN --security=insecure \
|
||||||
|
--mount=type=bind,from=host-modules,source=/,target=/lib/modules \
|
||||||
cd /kitchen && rm -f vm.raw && ./build-image.sh
|
cd /kitchen && rm -f vm.raw && ./build-image.sh
|
||||||
|
|
||||||
|
FROM scratch AS export
|
||||||
|
COPY --from=rootfs-builder /kitchen/vm.raw /vm.raw
|
||||||
|
|||||||
Reference in New Issue
Block a user