Skip to content
Snippets Groups Projects
Commit 1ed65023 authored by jan.bednarik's avatar jan.bednarik
Browse files

Dockerfile: swith to alpine

parent 25d3ec54
No related branches found
No related tags found
No related merge requests found
.env
.git
*.pyc
*.egg
*.egg-info
.cache
.pytest_cache
FROM python:3.6
FROM python:3.7-alpine
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
COPY requirements.txt ./
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
RUN apk add --no-cache nginx supervisor libpq \
&& apk add --no-cache --virtual=.build-deps build-base postgresql-dev libffi-dev \
&& pip install -r requirements.txt \
&& pip install gunicorn \
&& apk del .build-deps
RUN rm /etc/nginx/conf.d/default.conf \
&& echo "daemon off;" >> /etc/nginx/nginx.conf
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/
COPY . ./
RUN DATABASE_URL=none SECRET_KEY=xxx python manage.py collectstatic --noinput
......@@ -25,8 +20,6 @@ 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
ENTRYPOINT ["./entrypoint.sh"]
#!/bin/bash
#!/bin/sh
# 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=// )
mkdir -p $( dirname $(cat /etc/supervisor/conf.d/supervisor.conf | grep logfile= | grep "\.log" | sed s/.*logfile=// ) )
touch $( cat /etc/supervisor/conf.d/supervisor.conf | grep logfile= | grep "\.log" | sed s/.*logfile=// )
mkdir /run/nginx
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisor.conf --nodaemon
......@@ -14,7 +14,6 @@ stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[supervisord]
logfile=/var/log/supervisor/supervisord.log
logfile_maxbytes=10MB
......
psycopg2-binary
Django
graphene
graphene-django
......@@ -9,5 +10,4 @@ pyjwt
iso8601
arrow
bleach
psycopg2
dsnparse
......@@ -32,7 +32,7 @@ mako==1.0.7 # via oic
markupsafe==1.0 # via mako
oic==0.14.0
promise==2.2.1 # via graphene, graphene-django, graphql-core, graphql-relay
psycopg2==2.7.5
psycopg2-binary==2.7.5
pycparser==2.19 # via cffi
pycryptodomex==3.6.6 # via oic, pyjwkest
pyjwkest==1.4.0 # via oic
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment