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.

44 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.0
  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 --upgrade pip \
  22. && pip install itchat-uos==1.5.0.dev0 \
  23. && pip install --upgrade openai
  24. ADD ./entrypoint.sh /entrypoint.sh
  25. RUN chmod +x /entrypoint.sh
  26. RUN groupadd -r noroot \
  27. && useradd -r -g noroot -s /bin/bash -d /home/noroot noroot \
  28. && chown -R noroot:noroot ${BUILD_PREFIX}
  29. USER noroot
  30. ENTRYPOINT ["/entrypoint.sh"]