| FROM ubuntu:22.04 | |
| ENV TZ=Asia/Shanghai | |
| RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \ | |
| echo $TZ > /etc/timezone | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| RUN apt-get update && \ | |
| apt-get install -y -qq wget curl git python3 python3-pip tzdata | |
| RUN --mount=type=secret,id=git,mode=0444,required=true \ | |
| git clone "$(cat /run/secrets/git)" z | |
| WORKDIR /z | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| RUN pip install Flask | |
| RUN echo 'from flask import Flask\n\ | |
| import threading\n\ | |
| app = Flask(__name__)\n\ | |
| @app.route("/")\n\ | |
| def hello_world():\n\ | |
| return "Hello, World!"\n\ | |
| def run_flask():\n\ | |
| app.run(host="0.0.0.0", port=7860)\n\ | |
| flask_thread = threading.Thread(target=run_flask)\n\ | |
| flask_thread.start()\n\ | |
| print("Flask server is running in a separate thread.")\n' >> interactive-bot/__init__.py | |
| EXPOSE 7860 | |
| RUN chmod -R 777 /z | |
| CMD python3 -m interactive-bot |