Skip to content
Snippets Groups Projects
Unverified Commit 87f4331f authored by jan.bednarik's avatar jan.bednarik Committed by GitHub
Browse files

Merge pull request #14 from wotaen/admin_static

Static files now served with nginx
parents 877308de 2cec46d3
Branches
No related tags found
No related merge requests found
......@@ -3,10 +3,30 @@ FROM python:3.6
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
RUN pip install gunicorn
RUN apt-get update && apt-get install -y --no-install-recommends \
nginx \
supervisor \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get autoremove -y --purge
COPY ./requirements.txt /code/requirements.txt
RUN pip install -r requirements.txt && \
pip install gunicorn && \
rm /etc/nginx/sites-enabled/default && \
echo "daemon off;" >> /etc/nginx/nginx.conf
ADD . /code/
RUN DATABASE_URL=none SECRET_KEY=xxx python manage.py collectstatic --noinput
COPY conf/supervisor.conf /etc/supervisor/conf.d/supervisor.conf
COPY conf/nginx.conf /etc/nginx/conf.d/openlobby-server.conf
COPY conf/entrypoint.sh ./
WORKDIR /code
EXPOSE 8010
CMD ["sh", "-c", "make migrate & gunicorn -w 4 -b 0.0.0.0:8010 --access-logfile - --error-logfile - --capture-output openlobby.wsgi"]
ENTRYPOINT ["./entrypoint.sh"]
#!/bin/bash
# migrate
python manage.py migrate
# Create log dirs and files
mkdir -p $( dirname $(cat /etc/supervisor/supervisord.conf | grep logfile= | grep "\.log" | sed s/.*logfile=// ) )
touch $( cat /etc/supervisor/supervisord.conf | grep logfile= | grep "\.log" | sed s/.*logfile=// )
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisor.conf --nodaemon
\ No newline at end of file
server {
listen 80;
server_name 127.0.0.1;
location /static {
alias /code/static;
}
location / {
proxy_pass http://0.0.0.0:8000;
proxy_set_header Host $http_host;
}
}
[program:app-gunicorn]
command = gunicorn -w 4 -b 0.0.0.0:8010 --access-logfile - --error-logfile - --capture-output openlobby.wsgi
priority=2
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:nginx-app]
command = /usr/sbin/nginx
priority=3
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[supervisord]
logfile = /var/log/supervisor/supervisord.log
logfile_maxbytes = 10MB
logfile_backups = 5
loglevel = info
pidfile = /var/run/supervisord.pid
\ No newline at end of file
......@@ -114,11 +114,9 @@ USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'
LOGGING = {
'version': 1,
'handlers': {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment