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 CGO_ENABLED=0 go build -o /build/daemon . && \ CGO_ENABLED=0 go build -o /build/auth_server ./util/ RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \ go build -o /build/daemon . && \ CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \ go build -o /build/auth_server ./util/ FROM alpine:3.24 AS rootfs-builder ENV CLOUD_CONFIG_REPO="https://git.sfclub.cc/cloud/bearnet" ENV CLOUD_CONFIG_REVISION="wish" ENV CLOUD_GATEWAY_ADDRESS="10.0.0.119" RUN apk update && apk add alpine-make-vm-image COPY ./image /kitchen RUN sed -i "s#_REPO_#$CLOUD_CONFIG_REPO#g" /kitchen/overlay/daemon/update-keys.sh && \ sed -i "s#_REVISION_#$CLOUD_CONFIG_REVISION#g" /kitchen/overlay/daemon/update-keys.sh && \ sed -i "s#GATEWAY_ADDRESS#$CLOUD_GATEWAY_ADDRESS#g" /kitchen/overlay/etc/network/interfaces COPY --from=bubble-builder --chmod=755 /build/daemon /kitchen/overlay/usr/bin/bubble COPY --from=bubble-builder --chmod=755 /build/auth_server /kitchen/overlay/usr/bin/auth-server RUN --security=insecure \ --mount=type=bind,from=host-modules,source=/,target=/lib/modules \ cd /kitchen && rm -f vm.raw && ALPINE_BRANCH="3.24" ./build-image.sh FROM scratch AS export COPY --from=rootfs-builder /kitchen/vm.raw /vm.raw