27 lines
1.1 KiB
Docker
27 lines
1.1 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 ./gitea-auth/
|
|
|
|
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 ./gitea-auth/
|
|
|
|
FROM alpine:3.24 AS rootfs-builder
|
|
RUN apk update && apk add alpine-make-vm-image
|
|
COPY ./image /kitchen
|
|
COPY .env /kitchen/.env
|
|
RUN sh /kitchen/substitution.sh < /kitchen/.env
|
|
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
|
|
COPY ./secret/* /kitchen/overlay/etc/ssh/
|
|
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
|