From 42caa2ba70986349fccaae4e1c250ea97fe761bc Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 22 Feb 2024 18:57:38 +1100 Subject: [PATCH] Build possum inside test Dockerfile --- Dockerfile | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5cfe148d..2451b309 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,25 +2,38 @@ FROM alpine -RUN apk add go fuse bash - -RUN go install github.com/anacrolix/godo@v1 -RUN echo "$HOME" -ENV PATH="/root/go/bin:$PATH" +RUN apk add go fuse bash rustup git gcc musl-dev g++ +RUN rustup-init -y --profile minimal +ENV PATH="/root/.cargo/bin:$PATH" WORKDIR /src COPY . . +RUN git clone https://github.com/anacrolix/possum + +WORKDIR possum + +RUN git submodule update --init --recursive +RUN --mount=type=cache,target=/root/.cargo/registry \ + --mount=type=cache,target=/root/.cargo/git \ + --mount=type=cache,target=/src/possum/target \ + cargo build + +WORKDIR .. ARG GOCACHE=/root/.cache/go-build ARG GOMODCACHE=/root/go/pkg/mod RUN --mount=type=cache,target=$GOCACHE \ --mount=type=cache,target=$GOMODCACHE \ + CGO_LDFLAGS=possum/target/debug/libpossum.a \ go test -failfast ./... -# Can't use fuse inside Docker? Asks for modprobe fuse. +# # Can't use fuse inside Docker? Asks for modprobe fuse. -# RUN --mount=type=cache,target=$GOCACHE \ -# --mount=type=cache,target=$GOMODCACHE \ -# ./fs/test.sh +# RUN go install github.com/anacrolix/godo@v1 +# RUN echo "$HOME" +# ENV PATH="/root/go/bin:$PATH" +# # RUN --mount=type=cache,target=$GOCACHE \ +# # --mount=type=cache,target=$GOMODCACHE \ +# # ./fs/test.sh -- 2.44.0