32 lines
1.2 KiB
Docker
32 lines
1.2 KiB
Docker
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/
|
|
|
|
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 \
|
|
go build -o /build/auth_server ./util/
|
|
|
|
FROM alpine:latest 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/dhcp/dhclient.conf
|
|
COPY --from=bubble-builder /build/daemon /bin/bubble
|
|
COPY --from=bubble-builder /build/auth_server /bin/auth-server
|
|
RUN --security=insecure \
|
|
cd /kitchen && rm -f vm.raw && ./build-image.sh
|
|
|
|
|