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 RUN mkdir /code
WORKDIR /code WORKDIR /code
ADD requirements.txt /code/ COPY requirements.txt ./
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apk add --no-cache nginx supervisor libpq \
nginx \ && apk add --no-cache --virtual=.build-deps build-base postgresql-dev libffi-dev \
supervisor \ && pip install -r requirements.txt \
&& apt-get clean \ && pip install gunicorn \
&& rm -rf /var/lib/apt/lists/* \ && apk del .build-deps
&& apt-get autoremove -y --purge RUN rm /etc/nginx/conf.d/default.conf \
&& echo "daemon off;" >> /etc/nginx/nginx.conf
COPY ./requirements.txt /code/requirements.txt COPY . ./
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 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 ...@@ -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/nginx.conf /etc/nginx/conf.d/openlobby-server.conf
COPY conf/entrypoint.sh ./ COPY conf/entrypoint.sh ./
WORKDIR /code
EXPOSE 8010 EXPOSE 8010
ENTRYPOINT ["./entrypoint.sh"] ENTRYPOINT ["./entrypoint.sh"]
#!/bin/bash #!/bin/sh
# migrate # migrate
python manage.py migrate python manage.py migrate
# Create log dirs and files # Create log dirs and files
mkdir -p $( dirname $(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/supervisord.conf | grep logfile= | grep "\.log" | sed s/.*logfile=// ) touch $( cat /etc/supervisor/conf.d/supervisor.conf | grep logfile= | grep "\.log" | sed s/.*logfile=// )
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisor.conf --nodaemon mkdir /run/nginx
\ No newline at end of file
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisor.conf --nodaemon
...@@ -14,10 +14,9 @@ stdout_logfile_maxbytes=0 ...@@ -14,10 +14,9 @@ stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0
[supervisord] [supervisord]
logfile = /var/log/supervisor/supervisord.log logfile=/var/log/supervisor/supervisord.log
logfile_maxbytes = 10MB logfile_maxbytes=10MB
logfile_backups = 5 logfile_backups=5
loglevel = info loglevel=info
pidfile = /var/run/supervisord.pid pidfile=/var/run/supervisord.pid
\ No newline at end of file
psycopg2-binary
Django Django
graphene graphene
graphene-django graphene-django
...@@ -9,5 +10,4 @@ pyjwt ...@@ -9,5 +10,4 @@ pyjwt
iso8601 iso8601
arrow arrow
bleach bleach
psycopg2
dsnparse dsnparse
...@@ -32,7 +32,7 @@ mako==1.0.7 # via oic ...@@ -32,7 +32,7 @@ mako==1.0.7 # via oic
markupsafe==1.0 # via mako markupsafe==1.0 # via mako
oic==0.14.0 oic==0.14.0
promise==2.2.1 # via graphene, graphene-django, graphql-core, graphql-relay 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 pycparser==2.19 # via cffi
pycryptodomex==3.6.6 # via oic, pyjwkest pycryptodomex==3.6.6 # via oic, pyjwkest
pyjwkest==1.4.0 # via oic 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