fix build issue
This commit is contained in:
1
BUILD.sh
1
BUILD.sh
@@ -81,6 +81,7 @@ docker build \
|
||||
--builder bearcloud \
|
||||
--allow security.insecure \
|
||||
-f vm.Dockerfile \
|
||||
--build-context host-modules=/lib/modules \
|
||||
--target export \
|
||||
--output type=local,dest=./data \
|
||||
$VM_OPTS .
|
||||
|
||||
@@ -7,8 +7,10 @@ services:
|
||||
- "./test.sh:/test.sh"
|
||||
devices:
|
||||
- "/dev/kvm:/dev/kvm"
|
||||
- "/dev/net/tun:/dev/net/tun"
|
||||
entrypoint: ["/sbin/tini", "/test.sh"]
|
||||
cap_add:
|
||||
- CAP_SYS_ADMIN
|
||||
- CAP_NET_ADMIN
|
||||
tty: true
|
||||
stdin_open: true
|
||||
|
||||
@@ -11,6 +11,8 @@ CONFIGURE_SH="${SCRIPT_DIR}/configure.sh"
|
||||
|
||||
TMP=$(mktemp)
|
||||
|
||||
modprobe nbd max_parts=8 && [ -e /dev/nbd0 ] || mknod /dev/nbd0 b 43 0
|
||||
|
||||
cleanup() {
|
||||
rm $TMP
|
||||
}
|
||||
@@ -29,7 +31,7 @@ alpine-make-vm-image \
|
||||
--fs-skel-dir "$OVERLAY_DIR" \
|
||||
--fs-skel-chown root:root \
|
||||
--script-chroot \
|
||||
--packages "git curl docker cronie" \
|
||||
--packages "git curl docker cronie dhclient" \
|
||||
"$IMAGE_FILE" \
|
||||
"$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" \
|
||||
--cpus boot=${CPU_COUNT:-4} \
|
||||
--memory size=${MEMORY:-4G},shared=on \
|
||||
--net "tap=,mac=,ip=,mask="
|
||||
$@
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
FROM golang:1.25-alpine AS bubble-builder
|
||||
|
||||
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 . && \
|
||||
CGO_ENABLED=0 go build -o /build/auth_server ./util/
|
||||
|
||||
COPY . .
|
||||
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
|
||||
go build -o /build/daemon . && \
|
||||
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/auth_server /bin/auth-server
|
||||
RUN --security=insecure \
|
||||
--mount=type=bind,from=host-modules,source=/,target=/lib/modules \
|
||||
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