Sfoglia il codice sorgente

Move uwsgi config to file

This allows for runtime interpolation of `$PORT`
Jake Howard 2 anni fa
parent
commit
b2944f22ba
2 ha cambiato i file con 14 aggiunte e 13 eliminazioni
  1. 2 13
      Dockerfile
  2. 12 0
      etc/uwsgi.ini

+ 2 - 13
Dockerfile

@@ -39,23 +39,12 @@ RUN set -ex \
 RUN mkdir /code/
 WORKDIR /code/
 ADD . /code/
+ENV PORT 8000
 EXPOSE 8000
 
 # Add custom environment variables needed by Django or your settings file here:
 ENV DJANGO_SETTINGS_MODULE=bakerydemo.settings.production DJANGO_DEBUG=off
 
-# Tell uWSGI where to find your wsgi file:
-ENV UWSGI_WSGI_FILE=bakerydemo/wsgi.py
-
-# Base uWSGI configuration (you shouldn't need to change these):
-ENV UWSGI_VIRTUALENV=/venv UWSGI_HTTP=:8000 UWSGI_MASTER=1 UWSGI_HTTP_AUTO_CHUNKED=1 UWSGI_HTTP_KEEPALIVE=1 UWSGI_LAZY_APPS=1 UWSGI_WSGI_ENV_BEHAVIOR=holy
-
-# Number of uWSGI workers and threads per worker (customize as needed):
-ENV UWSGI_WORKERS=2 UWSGI_THREADS=4
-
-# uWSGI uploaded media file serving configuration:
-ENV UWSGI_STATIC_MAP="/media/=/code/bakerydemo/media/"
-
 # Call collectstatic with dummy environment variables:
 RUN DATABASE_URL=postgres://none REDIS_URL=none /venv/bin/python manage.py collectstatic --noinput
 
@@ -69,4 +58,4 @@ VOLUME ["/code/bakerydemo/media/images/"]
 ENTRYPOINT ["/code/docker-entrypoint.sh"]
 
 # Start uWSGI
-CMD ["/venv/bin/uwsgi", "--show-config"]
+CMD ["/venv/bin/uwsgi", "/code/etc/uwsgi.ini"]

+ 12 - 0
etc/uwsgi.ini

@@ -0,0 +1,12 @@
+[uwsgi]
+http-socket=:$(PORT)
+master=true
+workers=2
+threads=4
+http-keepalive=1
+virtualenv=/venv
+wsgi-env-behaviour=holy
+http-auto-chunked=true
+lazy-apps=true
+static-map=/media/=/code/bakerydemo/media/
+wsgi-file=bakerydemo/wsgi.py