From a2ef4491bc297292fd3377480c1afaf7d9c3e072 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 3 Jan 2020 13:42:42 +0100 Subject: [PATCH] broken Dockerfile again --- Dockerfile | 12 +++++++----- init.sh | 7 +++++++ 2 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 init.sh diff --git a/Dockerfile b/Dockerfile index 26847963..cdcd8290 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,16 @@ FROM debian +RUN mkdir /srv/app +RUN mkdir /srv/venv RUN apt-get update RUN apt-get install -y default-libmysqlclient-dev gcc RUN apt-get install -y postgresql postgresql-contrib libpq-dev python-psycopg2 RUN apt-get update && apt-get install \ -y --no-install-recommends python3 python3-virtualenv python3-dev RUN apt-get update && apt-get install libssl-dev -RUN python3 -m virtualenv --python=/usr/bin/python3 /opt/venv -COPY ./requirements.txt /usr/src/app/ -WORKDIR /usr/src/app/ -RUN . /opt/venv/bin/activate && pip install -r requirements.txt +RUN python3 -m virtualenv --python=/srv/venv/ +COPY ./requirements.txt /srv/app/ +WORKDIR /srv/app/ +RUN . /srv/venv/bin/activate && pip install -r requirements.txt COPY . . EXPOSE 8000 -CMD ["python", "./manage.py", "runserver"] +CMD ["init.sh"] diff --git a/init.sh b/init.sh new file mode 100644 index 00000000..c93635f0 --- /dev/null +++ b/init.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +source /srv/venv/bin/activate +cd /srv/app +python manage.py migrate +python manage.py collectstatic --noinput +python manage.py runserver