Dockerfile 798 B

1234567891011121314151617181920212223242526
  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. RUN pip install -r /code/requirements.txt
  13. # 配置 uWSGI
  14. ENV UWSGI_WSGI_FILE=project.wsgi
  15. ENV UWSGI_HTTP=:8000
  16. ENV UWSGI_MASTER=1
  17. ENV UWSGI_WORKERS=2
  18. ENV UWSGI_THREADS=4
  19. CMD ["uwsgi", "--http", "$UWSGI_HTTP", "--http-timeout", "86400", "--master", "--wsgi-file", "$UWSGI_WSGI_FILE", "--processes", "1", "--threads", "$UWSGI_THREADS", "--workers", "$UWSGI_WORKERS"]