summaryrefslogtreecommitdiffstats
path: root/django
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2018-12-13 00:05:49 +0100
committerSuren A. Chilingaryan <csa@suren.me>2018-12-13 00:05:49 +0100
commit9c3d5c48694db1018d50aa85acad434f47e5ed0b (patch)
treebee24b887c12d1abaa4d942525a6c1d304dd200d /django
downloadbiomedisa-9c3d5c48694db1018d50aa85acad434f47e5ed0b.tar.gz
biomedisa-9c3d5c48694db1018d50aa85acad434f47e5ed0b.tar.bz2
biomedisa-9c3d5c48694db1018d50aa85acad434f47e5ed0b.tar.xz
biomedisa-9c3d5c48694db1018d50aa85acad434f47e5ed0b.zip
Initial import
Diffstat (limited to 'django')
-rw-r--r--django/Dockerfile23
-rw-r--r--django/Makefile16
-rwxr-xr-xdjango/docker-entrypoint.sh21
-rwxr-xr-xdjango/run-bootstrap.sh5
-rwxr-xr-xdjango/run.sh3
5 files changed, 68 insertions, 0 deletions
diff --git a/django/Dockerfile b/django/Dockerfile
new file mode 100644
index 0000000..0f1e044
--- /dev/null
+++ b/django/Dockerfile
@@ -0,0 +1,23 @@
+FROM ubuntu:16.04
+MAINTAINER Suren A. Chilingaryan <csa@suren.me>
+
+# Install Devel & Python
+RUN apt-get update -qq \
+ && apt-get install --no-install-recommends -y \
+ gcc git pkg-config netcat \
+ telnet iputils-ping dnsutils \
+ python python-dev python-pip python-setuptools python-virtualenv python-wheel python-numpy python-scipy python-h5py python-yaml python-pydot python-matplotlib libopenblas-base \
+ mysql-client libmysqlclient-dev
+
+# upgrade pip
+RUN pip --no-cache-dir install --upgrade pip
+
+# install dependencies from python packages
+RUN pip --no-cache-dir install \
+ setuptools==39.1.0 numpy==1.14.5 tifffile==0.14.0 SimpleParse==2.1.1 redis==2.10.6 rq==0.12 \
+ scipy weave scikit-image opencv-python h5py pydicom Pillow django MySQL
+
+COPY *-entrypoint.sh /
+COPY run*.sh /
+ENTRYPOINT ["/docker-entrypoint.sh"]
+CMD ["/run.sh"]
diff --git a/django/Makefile b/django/Makefile
new file mode 100644
index 0000000..78b94ac
--- /dev/null
+++ b/django/Makefile
@@ -0,0 +1,16 @@
+all: build
+#install: push
+
+.PHONY: rebuild build push start stop restart bash
+
+build: Dockerfile
+ docker build --tag chsa/biomedisa-django:latest .
+
+rebuild: Dockerfile
+ docker build --no-cache --tag chsa/biomedisa-django:latest .
+
+#push: build
+# docker push chsa/biomedisa:latest
+
+bash: build
+ docker run -it chsa/biomedisa-django /bin/bash
diff --git a/django/docker-entrypoint.sh b/django/docker-entrypoint.sh
new file mode 100755
index 0000000..3a132a3
--- /dev/null
+++ b/django/docker-entrypoint.sh
@@ -0,0 +1,21 @@
+#! /bin/bash
+
+set -e
+
+export PYTHONPATH=/biomedisa:${PYTHONPATH}
+export DJANGO_SETTINGS_MODULE=biomedisa.settings
+
+if ! whoami &> /dev/null; then
+ if [ -w /etc/passwd ]; then
+ echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd
+ fi
+fi
+
+until nc -z -v -w30 $MYSQL_HOST 3306; do
+ echo "Waiting for database connection..."
+ sleep 1
+done
+
+cd /biomedisa
+echo "Running: $@"
+exec "$@"
diff --git a/django/run-bootstrap.sh b/django/run-bootstrap.sh
new file mode 100755
index 0000000..c57325b
--- /dev/null
+++ b/django/run-bootstrap.sh
@@ -0,0 +1,5 @@
+#! /bin/bash
+
+python manage.py makemigrations
+python manage.py migrate
+python manage.py createsuperuser
diff --git a/django/run.sh b/django/run.sh
new file mode 100755
index 0000000..f473012
--- /dev/null
+++ b/django/run.sh
@@ -0,0 +1,3 @@
+#! /bin/bash
+
+python manage.py runserver 0.0.0.0:8000