Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

46 lines
1.3KB

  1. FROM python:3.7.9
  2. LABEL maintainer="foo@bar.com"
  3. ARG TZ='Asia/Shanghai'
  4. ARG CHATGPT_ON_WECHAT_VER=1.0.2
  5. ENV BUILD_PREFIX=/app \
  6. BUILD_OPEN_AI_API_KEY='YOUR OPEN AI KEY HERE'
  7. RUN apt-get update && \
  8. apt-get install -y --no-install-recommends \
  9. wget \
  10. curl && \
  11. rm -rf /var/lib/apt/lists/*
  12. RUN wget -t 3 -T 30 -nv -O chatgpt-on-wechat-${CHATGPT_ON_WECHAT_VER}.tar.gz \
  13. https://github.com/zhayujie/chatgpt-on-wechat/archive/refs/tags/${CHATGPT_ON_WECHAT_VER}.tar.gz \
  14. && tar -xzf chatgpt-on-wechat-${CHATGPT_ON_WECHAT_VER}.tar.gz \
  15. && mv chatgpt-on-wechat-${CHATGPT_ON_WECHAT_VER} ${BUILD_PREFIX} \
  16. && rm chatgpt-on-wechat-${CHATGPT_ON_WECHAT_VER}.tar.gz
  17. WORKDIR ${BUILD_PREFIX}
  18. RUN cd ${BUILD_PREFIX} \
  19. && cp config-template.json ${BUILD_PREFIX}/config.json \
  20. && sed -i "2s/YOUR API KEY/${BUILD_OPEN_AI_API_KEY}/" ${BUILD_PREFIX}/config.json
  21. RUN /usr/local/bin/python -m pip install --no-cache --upgrade pip \
  22. && pip install --no-cache \
  23. itchat-uos==1.5.0.dev0 \
  24. openai \
  25. wechaty
  26. ADD ./entrypoint.sh /entrypoint.sh
  27. RUN chmod +x /entrypoint.sh
  28. RUN groupadd -r noroot \
  29. && useradd -r -g noroot -s /bin/bash -d /home/noroot noroot \
  30. && chown -R noroot:noroot ${BUILD_PREFIX}
  31. USER noroot
  32. ENTRYPOINT ["/entrypoint.sh"]