Dockerfile 821 B

123456789101112131415161718192021222324252627
  1. FROM python:3.6
  2. # 安装 git
  3. RUN apt-get update && apt-get install -y git
  4. # 设置用户名和密码作为构建参数
  5. ARG USERNAME=yf_yzl
  6. ARG PASSWORD=1qaz!QAZ
  7. # 对密码进行 URL 编码
  8. RUN export PASSWORD_ENCODED=$(printf %s "${PASSWORD}" | jq -s -R -r @uri)
  9. # 克隆 Git 仓库,使用 URL 编码的密码
  10. RUN git clone https://${USERNAME}:${PASSWORD_ENCODED}@114.115.147.140:63000/yf_yzl/QAWeb.git /code
  11. # 安装依赖
  12. COPY requirements.txt /code/
  13. RUN pip install -r requirements.txt
  14. # 配置 uWSGI
  15. ENV UWSGI_WSGI_FILE=project.wsgi
  16. ENV UWSGI_HTTP=:8000
  17. ENV UWSGI_MASTER=1
  18. ENV UWSGI_WORKERS=2
  19. ENV UWSGI_THREADS=4
  20. CMD ["uwsgi", "--http", "$UWSGI_HTTP", "--http-timeout", "86400", "--master", "--wsgi-file", "$UWSGI_WSGI_FILE", "--processes", "1", "--threads", "$UWSGI_THREADS", "--workers", "$UWSGI_WORKERS"]