我想在带证书的https上用Docker部署Django应用。
对于其他所有Django Docker应用程序,我都会这样:
FROM python:3.6
RUN apt-get update && apt-get install -y python-dev && apt-get install -y libldap2-dev && apt-get install -y libsasl2-dev && apt-get install -y libssl-dev && apt-get install -y sasl2-bin
RUN apt-get update
RUN apt-get install -y locales locales-all
ENV PYTHONUNBUFFERED 1
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir --upgrade setuptools
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
RUN chmod u+rwx manage.py
RUN chmod 777 logs
RUN if [ ! -d ./static ]; then mkdir static; fi
RUN python manage.py collectstatic --no-input
RUN chown -R 10000:10000 ./
EXPOSE 8080
CMD ["sh", "./run-django.sh"]
然后在运行django中
uwsgi --chdir=/usr/src/app --module=app.wsgi:application --master --pidfile=/tmp/project-master.pid --http=0.0.0.0:8080 --processes=5 --max-requests=5000 --vacuum --uid=10000 --gid=10000 --static-map /static=/usr/src/app/static
我拥有的yml
文件中
docker_container:
name: "{{ app_container_name }}"
...
ports:
- "{{ deploy_port }}:8080"
这有效!
现在我想将其部署在https:
我尝试
uwsgi --chdir=/usr/src/app --module=app.wsgi:application --master --pidfile=/tmp/project-master.pid --https=0.0.0.0:443,certificate.crt,privateKey.key,HIGH --processes=5 --max-requests=5000 --vacuum --uid=10000 --gid=10000 --static-map /static=/usr/src/app/static
和
docker_container:
name: "{{ app_container_name }}"
...
ports:
- "{{ deploy_port }}:443"
uwsgi不会启动。
如何在docker内部执行https?