Dockerfile 975 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. # On macOS, docker does not support IPv6.
  2. FROM alpine
  3. RUN apk add go fuse bash rustup git gcc musl-dev g++
  4. RUN rustup-init -y --profile minimal
  5. ENV PATH="/root/.cargo/bin:$PATH"
  6. WORKDIR /src
  7. COPY . .
  8. RUN git clone https://github.com/anacrolix/possum
  9. WORKDIR possum
  10. RUN git submodule update --init --recursive
  11. RUN --mount=type=cache,target=/root/.cargo/registry \
  12. --mount=type=cache,target=/root/.cargo/git \
  13. --mount=type=cache,target=/src/possum/target \
  14. cargo build
  15. WORKDIR ..
  16. ARG GOCACHE=/root/.cache/go-build
  17. ARG GOMODCACHE=/root/go/pkg/mod
  18. RUN --mount=type=cache,target=$GOCACHE \
  19. --mount=type=cache,target=$GOMODCACHE \
  20. CGO_LDFLAGS=possum/target/debug/libpossum.a \
  21. go test -failfast ./...
  22. # # Can't use fuse inside Docker? Asks for modprobe fuse.
  23. # RUN go install github.com/anacrolix/godo@v1
  24. # RUN echo "$HOME"
  25. # ENV PATH="/root/go/bin:$PATH"
  26. # # RUN --mount=type=cache,target=$GOCACHE \
  27. # # --mount=type=cache,target=$GOMODCACHE \
  28. # # ./fs/test.sh