dockerfile 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. FROM golang:1.20.6 AS builder
  2. COPY . /app
  3. WORKDIR /app
  4. # if you located in China, you can use aliyun mirror to speed up
  5. # && echo "deb http://mirrors.aliyun.com/debian testing main" > /etc/apt/sources.list
  6. # install dependencies and build binary
  7. RUN apt-get update && apt-get install -y pkg-config gcc libseccomp-dev && go mod tidy && bash ./build/build_amd64.sh
  8. FROM python:3.10-slim-bookworm as tester
  9. # if you located in China, you can use aliyun mirror to speed up
  10. # && echo "deb http://mirrors.aliyun.com/debian testing main" > /etc/apt/sources.list
  11. # install system dependencies
  12. RUN echo "deb http://deb.debian.org/debian testing main" > /etc/apt/sources.list \
  13. && apt-get update \
  14. && apt-get install -y --no-install-recommends \
  15. pkg-config \
  16. libseccomp-dev \
  17. wget \
  18. curl \
  19. xz-utils \
  20. zlib1g \
  21. expat \
  22. perl \
  23. libsqlite3-0 \
  24. && apt-get clean \
  25. && rm -rf /var/lib/apt/lists/*
  26. # workdir
  27. WORKDIR /app
  28. # checkout
  29. COPY . /app
  30. # copy binary and env from builder
  31. COPY --from=builder /app/internal/core/runner/python/python.so /app/internal/core/runner/python/python.so
  32. COPY --from=builder /app/internal/core/runner/nodejs/nodejs.so /app/internal/core/runner/nodejs/nodejs.so
  33. # copy test config file
  34. COPY conf/config.yaml /conf/config.yaml
  35. # copy python dependencies
  36. COPY dependencies/python-requirements.txt /dependencies/python-requirements.txt
  37. # install python dependencies
  38. RUN pip3 install --no-cache-dir httpx==0.27.2 requests==2.32.3 jinja2==3.0.3 PySocks httpx[socks]
  39. # install node
  40. RUN wget -O /opt/node-v20.11.1-linux-x64.tar.xz https://npmmirror.com/mirrors/node/v20.11.1/node-v20.11.1-linux-x64.tar.xz \
  41. && tar -xvf /opt/node-v20.11.1-linux-x64.tar.xz -C /opt \
  42. && ln -s /opt/node-v20.11.1-linux-x64/bin/node /usr/local/bin/node \
  43. && rm -f /opt/node-v20.11.1-linux-x64.tar.xz
  44. # install golang 1.20.6
  45. RUN wget https://golang.org/dl/go1.20.6.linux-amd64.tar.gz \
  46. && tar -C /usr/local -xzf go1.20.6.linux-amd64.tar.gz \
  47. && ln -s /usr/local/go/bin/go /usr/local/bin/go \
  48. && rm -f go1.20.6.linux-amd64.tar.gz
  49. # run test
  50. RUN go test -timeout 120s -v ./tests/integration_tests/...