From 46f9fea2c29062a90f380a827387476f194e203e Mon Sep 17 00:00:00 2001 From: Olivier DOSSMANN Date: Tue, 22 Aug 2017 23:15:30 +0200 Subject: [PATCH] En cours - Travail sur un conteneur afin de lancer l'application avec UWSGI --- Dockerfile | 30 ++++++++++++++++++++++++++++++ collection/collection/settings.py | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fcd288c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM alpine:3.6 + +ENV APPS_DIR /opt/apps +ENV DB_DIR $APPS_DIR/db +ENV STATIC_ROOT $APPS_DIR/static + +COPY requirements.txt $APPS_DIR/ + +WORKDIR $APPS_DIR + +RUN set -ex \ + && buildDeps=' \ + build-base \ + python3-dev \ + ' \ + && apk --no-cache --update add \ + mailcap \ + python3 \ + $buildDeps \ + && pip3 install --no-cache-dir --upgrade pip \ + && pip3 install --no-cache-dir --upgrade -r requirements.txt \ + && apk del $buildDeps \ + && rm -rf /var/cache/apk/* + +COPY ./collection $APPS_DIR + +VOLUME $DB_DIR + +EXPOSE 8000 +CMD ["/bin/sh"] diff --git a/collection/collection/settings.py b/collection/collection/settings.py index 8ef4de8..29fac16 100644 --- a/collection/collection/settings.py +++ b/collection/collection/settings.py @@ -78,7 +78,7 @@ WSGI_APPLICATION = 'collection.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'NAME': os.path.join(BASE_DIR, 'db', 'db.sqlite3'), } }