mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-21 06:07:13 +08:00
feat: update python in docker to 3.10
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
FROM python:3.7.9-alpine
|
FROM python:3.10-alpine
|
||||||
|
|
||||||
LABEL maintainer="foo@bar.com"
|
LABEL maintainer="foo@bar.com"
|
||||||
ARG TZ='Asia/Shanghai'
|
ARG TZ='Asia/Shanghai'
|
||||||
@@ -22,9 +22,7 @@ RUN apk add --no-cache \
|
|||||||
&& cd ${BUILD_PREFIX} \
|
&& cd ${BUILD_PREFIX} \
|
||||||
&& cp config-template.json ${BUILD_PREFIX}/config.json \
|
&& cp config-template.json ${BUILD_PREFIX}/config.json \
|
||||||
&& /usr/local/bin/python -m pip install --no-cache --upgrade pip \
|
&& /usr/local/bin/python -m pip install --no-cache --upgrade pip \
|
||||||
&& pip install --no-cache \
|
&& pip install --no-cache -r requirements.txt \
|
||||||
itchat-uos==1.5.0.dev0 \
|
|
||||||
openai \
|
|
||||||
&& apk del curl wget
|
&& apk del curl wget
|
||||||
|
|
||||||
WORKDIR ${BUILD_PREFIX}
|
WORKDIR ${BUILD_PREFIX}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM python:3.7.9
|
FROM python:3.10
|
||||||
|
|
||||||
LABEL maintainer="foo@bar.com"
|
LABEL maintainer="foo@bar.com"
|
||||||
ARG TZ='Asia/Shanghai'
|
ARG TZ='Asia/Shanghai'
|
||||||
@@ -23,9 +23,7 @@ RUN apt-get update \
|
|||||||
&& cd ${BUILD_PREFIX} \
|
&& cd ${BUILD_PREFIX} \
|
||||||
&& cp config-template.json ${BUILD_PREFIX}/config.json \
|
&& cp config-template.json ${BUILD_PREFIX}/config.json \
|
||||||
&& /usr/local/bin/python -m pip install --no-cache --upgrade pip \
|
&& /usr/local/bin/python -m pip install --no-cache --upgrade pip \
|
||||||
&& pip install --no-cache \
|
&& pip install --no-cache -r requirements.txt
|
||||||
itchat-uos==1.5.0.dev0 \
|
|
||||||
openai
|
|
||||||
|
|
||||||
WORKDIR ${BUILD_PREFIX}
|
WORKDIR ${BUILD_PREFIX}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM python:3.7.9-alpine
|
FROM python:3.10-alpine
|
||||||
|
|
||||||
LABEL maintainer="foo@bar.com"
|
LABEL maintainer="foo@bar.com"
|
||||||
ARG TZ='Asia/Shanghai'
|
ARG TZ='Asia/Shanghai'
|
||||||
@@ -7,22 +7,17 @@ ARG CHATGPT_ON_WECHAT_VER
|
|||||||
|
|
||||||
ENV BUILD_PREFIX=/app
|
ENV BUILD_PREFIX=/app
|
||||||
|
|
||||||
COPY chatgpt-on-wechat.tar.gz ./chatgpt-on-wechat.tar.gz
|
ADD . ${BUILD_PREFIX}
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache bash ffmpeg espeak \
|
||||||
bash \
|
|
||||||
&& tar -xf chatgpt-on-wechat.tar.gz \
|
|
||||||
&& mv chatgpt-on-wechat ${BUILD_PREFIX} \
|
|
||||||
&& cd ${BUILD_PREFIX} \
|
&& cd ${BUILD_PREFIX} \
|
||||||
&& cp config-template.json ${BUILD_PREFIX}/config.json \
|
&& cp config-template.json config.json \
|
||||||
&& /usr/local/bin/python -m pip install --no-cache --upgrade pip \
|
&& /usr/local/bin/python -m pip install --no-cache --upgrade pip \
|
||||||
&& pip install --no-cache \
|
&& pip install --no-cache -r requirements.txt
|
||||||
itchat-uos==1.5.0.dev0 \
|
|
||||||
openai
|
|
||||||
|
|
||||||
WORKDIR ${BUILD_PREFIX}
|
WORKDIR ${BUILD_PREFIX}
|
||||||
|
|
||||||
ADD ./entrypoint.sh /entrypoint.sh
|
ADD docker/entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
RUN chmod +x /entrypoint.sh \
|
RUN chmod +x /entrypoint.sh \
|
||||||
&& adduser -D -h /home/noroot -u 1000 -s /bin/bash noroot \
|
&& adduser -D -h /home/noroot -u 1000 -s /bin/bash noroot \
|
||||||
@@ -30,4 +25,4 @@ RUN chmod +x /entrypoint.sh \
|
|||||||
|
|
||||||
USER noroot
|
USER noroot
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["docker/entrypoint.sh"]
|
||||||
@@ -1,8 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# move chatgpt-on-wechat
|
cd .. && docker build -f Dockerfile \
|
||||||
tar -zcf chatgpt-on-wechat.tar.gz --exclude=../../chatgpt-on-wechat/docker ../../chatgpt-on-wechat
|
|
||||||
|
|
||||||
# build image
|
|
||||||
docker build -f Dockerfile.latest \
|
|
||||||
-t zhayujie/chatgpt-on-wechat .
|
-t zhayujie/chatgpt-on-wechat .
|
||||||
@@ -10,17 +10,17 @@ CHATGPT_ON_WECHAT_EXEC=${CHATGPT_ON_WECHAT_EXEC:-""}
|
|||||||
|
|
||||||
# use environment variables to pass parameters
|
# use environment variables to pass parameters
|
||||||
# if you have not defined environment variables, set them below
|
# if you have not defined environment variables, set them below
|
||||||
export OPEN_AI_API_KEY=${OPEN_AI_API_KEY:-'YOUR API KEY'}
|
# export OPEN_AI_API_KEY=${OPEN_AI_API_KEY:-'YOUR API KEY'}
|
||||||
export OPEN_AI_PROXY=${OPEN_AI_PROXY:-""}
|
# export OPEN_AI_PROXY=${OPEN_AI_PROXY:-""}
|
||||||
export SINGLE_CHAT_PREFIX=${SINGLE_CHAT_PREFIX:-'["bot", "@bot"]'}
|
# export SINGLE_CHAT_PREFIX=${SINGLE_CHAT_PREFIX:-'["bot", "@bot"]'}
|
||||||
export SINGLE_CHAT_REPLY_PREFIX=${SINGLE_CHAT_REPLY_PREFIX:-'"[bot] "'}
|
# export SINGLE_CHAT_REPLY_PREFIX=${SINGLE_CHAT_REPLY_PREFIX:-'"[bot] "'}
|
||||||
export GROUP_CHAT_PREFIX=${GROUP_CHAT_PREFIX:-'["@bot"]'}
|
# export GROUP_CHAT_PREFIX=${GROUP_CHAT_PREFIX:-'["@bot"]'}
|
||||||
export GROUP_NAME_WHITE_LIST=${GROUP_NAME_WHITE_LIST:-'["ChatGPT测试群", "ChatGPT测试群2"]'}
|
# export GROUP_NAME_WHITE_LIST=${GROUP_NAME_WHITE_LIST:-'["ChatGPT测试群", "ChatGPT测试群2"]'}
|
||||||
export IMAGE_CREATE_PREFIX=${IMAGE_CREATE_PREFIX:-'["画", "看", "找"]'}
|
# export IMAGE_CREATE_PREFIX=${IMAGE_CREATE_PREFIX:-'["画", "看", "找"]'}
|
||||||
export CONVERSATION_MAX_TOKENS=${CONVERSATION_MAX_TOKENS:-"1000"}
|
# export CONVERSATION_MAX_TOKENS=${CONVERSATION_MAX_TOKENS:-"1000"}
|
||||||
export SPEECH_RECOGNITION=${SPEECH_RECOGNITION:-"False"}
|
# export SPEECH_RECOGNITION=${SPEECH_RECOGNITION:-"False"}
|
||||||
export CHARACTER_DESC=${CHARACTER_DESC:-"你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。"}
|
# export CHARACTER_DESC=${CHARACTER_DESC:-"你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。"}
|
||||||
export EXPIRES_IN_SECONDS=${EXPIRES_IN_SECONDS:-"3600"}
|
# export EXPIRES_IN_SECONDS=${EXPIRES_IN_SECONDS:-"3600"}
|
||||||
|
|
||||||
# CHATGPT_ON_WECHAT_PREFIX is empty, use /app
|
# CHATGPT_ON_WECHAT_PREFIX is empty, use /app
|
||||||
if [ "$CHATGPT_ON_WECHAT_PREFIX" == "" ] ; then
|
if [ "$CHATGPT_ON_WECHAT_PREFIX" == "" ] ; then
|
||||||
@@ -38,7 +38,7 @@ if [ "$CHATGPT_ON_WECHAT_EXEC" == "" ] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# modify content in config.json
|
# modify content in config.json
|
||||||
if [ "$OPEN_AI_API_KEY" == "YOUR API KEY" ] ; then
|
if [ "$OPEN_AI_API_KEY" == "YOUR API KEY" ] || [ "$OPEN_AI_API_KEY" == "" ]; then
|
||||||
echo -e "\033[31m[Warning] You need to set OPEN_AI_API_KEY before running!\033[0m"
|
echo -e "\033[31m[Warning] You need to set OPEN_AI_API_KEY before running!\033[0m"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user