我无法使用uWSGI启动dockerized Django应用程序。 以下是正在使用的配置。
Dockerfile
FROM python:3.6
ENV PYTHONUNBUFFERED 1
RUN apt-get update
RUN apt-get install -y swig libssl-dev dpkg-dev netcat unixodbc-dev python-dev libldap2-dev libsasl2-dev
RUN mkdir /code
WORKDIR /code
COPY app/ /code/
RUN pip install -U pip
ENV PIP_TRUSTED_HOST="pypi.python.org pypi.org files.pythonhosted.org"
RUN apt-get install ca-certificates
RUN pip install -Ur requirements.txt
RUN chmod -R 777 /code
CMD ["/code/run.sh"]
run.sh
#!/bin/bash
./manage.py migrate
uwsgi --ini uwsgi.ini
应用程序/ uwsgi.ini
[uwsgi]
http-socket = :8000
chdir = /opt/code/
module = app.wsgi:application
master = 1
processes = 2
threads = 2
启动容器时出错
Operations to perform:
Apply all migrations: admin, api, auth, contenttypes, sessions
Running migrations:
No migrations to apply.
[uWSGI] getting INI configuration from uwsgi.ini
*** Starting uWSGI 2.0.17 (64bit) on [Wed May 30 05:35:23 2018] ***
compiled with version: 6.3.0 20170516 on 30 May 2018 05:34:47
os: Linux-4.9.12-moby #1 SMP Tue Feb 28 12:11:36 UTC 2017
nodename: 0a9f49a479c7
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 6
current working directory: /code
detected binary path: /usr/local/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /opt/code/
chdir(): No such file or directory [core/uwsgi.c line 2629]
有人可以帮我弄清楚这个配置有什么问题吗?
以下是项目结构 -
project
|--app
|--app
|--requirements.txt
|--run.sh
|--uwsgi.ini
|--manage.py
|--Dockerfile