Dockerfile.debian 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. FROM python:3.10
  2. LABEL maintainer="foo@bar.com"
  3. ARG TZ='Asia/Shanghai'
  4. ARG CHATGPT_ON_WECHAT_VER
  5. ENV BUILD_PREFIX=/app
  6. RUN apt-get update \
  7. && apt-get install -y --no-install-recommends \
  8. wget \
  9. curl \
  10. && rm -rf /var/lib/apt/lists/* \
  11. && export BUILD_GITHUB_TAG=${CHATGPT_ON_WECHAT_VER:-`curl -sL "https://api.github.com/repos/zhayujie/chatgpt-on-wechat/releases/latest" | \
  12. grep '"tag_name":' | \
  13. sed -E 's/.*"([^"]+)".*/\1/'`} \
  14. && wget -t 3 -T 30 -nv -O chatgpt-on-wechat-${BUILD_GITHUB_TAG}.tar.gz \
  15. https://github.com/zhayujie/chatgpt-on-wechat/archive/refs/tags/${BUILD_GITHUB_TAG}.tar.gz \
  16. && tar -xzf chatgpt-on-wechat-${BUILD_GITHUB_TAG}.tar.gz \
  17. && mv chatgpt-on-wechat-${BUILD_GITHUB_TAG} ${BUILD_PREFIX} \
  18. && rm chatgpt-on-wechat-${BUILD_GITHUB_TAG}.tar.gz \
  19. && cd ${BUILD_PREFIX} \
  20. && cp config-template.json ${BUILD_PREFIX}/config.json \
  21. && /usr/local/bin/python -m pip install --no-cache --upgrade pip \
  22. && pip install --no-cache -r requirements.txt \
  23. && pip install --no-cache -r requirements-optional.txt
  24. WORKDIR ${BUILD_PREFIX}
  25. ADD ./entrypoint.sh /entrypoint.sh
  26. RUN chmod +x /entrypoint.sh \
  27. && mkdir -p /home/noroot \
  28. && groupadd -r noroot \
  29. && useradd -r -g noroot -s /bin/bash -d /home/noroot noroot \
  30. && chown -R noroot:noroot /home/noroot ${BUILD_PREFIX} /usr/local/lib
  31. USER noroot
  32. ENTRYPOINT ["/entrypoint.sh"]