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.

41 lines
1.2KB

  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. && cat ${BUILD_PREFIX}/config.json
  22. RUN /usr/local/bin/python -m pip install --upgrade pip \
  23. && pip install itchat-uos==1.5.0.dev0 \
  24. && pip install --upgrade openai
  25. RUN groupadd -r noroot \
  26. && useradd -r -g noroot noroot \
  27. && chown -R noroot:noroot ${BUILD_PREFIX}
  28. USER noroot
  29. CMD ["python","app.py"]