From 8828b8e7b76bc06b564b534feee6efac7d6725f8 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Fri, 25 May 2018 14:46:27 +0200 Subject: [PATCH] Add docker files --- .dockerignore | 4 ++++ Dockerfile | 25 +++++++++++++++++++++++++ bash/run-prod.sh | 4 ++++ 3 files changed, 33 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 bash/run-prod.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..855c1ea --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +db.sqlite3 +.idea +.env +staticfiles diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..330c291 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM python:3.6 + +RUN ln -fs /usr/share/zoneinfo/Europe/Paris /etc/localtime && \ + dpkg-reconfigure -f noninteractive tzdata + +WORKDIR /app +EXPOSE 8000 +VOLUME /app/staticfiles + +RUN pip3 install pipenv +COPY Pipfile Pipfile.lock ./ +RUN pipenv install + +COPY . ./ + +RUN chmod +x bash/run-prod.sh +CMD bash/run-prod.sh + +ENV DATABASE_URL postgres://postgresql:postgresql@db:5432/workout +ENV SECRET_KEY '' +ENV MAILGUN_ACCESS_KEY '' +ENV MAILGUN_SERVER_NAME '' +ENV DJANGO_ENV '' +ENV ADMIN_EMAIL '' +ENV SERVER_EMAIL '' diff --git a/bash/run-prod.sh b/bash/run-prod.sh new file mode 100644 index 0000000..7d02d9c --- /dev/null +++ b/bash/run-prod.sh @@ -0,0 +1,4 @@ +#!/bin/sh +yes yes | pipenv run python manage.py migrate && \ +pipenv run python manage.py collectstatic --noinput && \ +pipenv run gunicorn manuels_collection.wsgi -b 0.0.0.0:8000 --log-file -