diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..ef1f9eec --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +LABEL authors="Micropyramid" + +FROM python:3.6 + +WORKDIR /app + +# Intall dependencies +COPY requirements.txt /app/ + +COPY . /app + +RUN chmod +x /app/entrypoint.sh +ENTRYPOINT ["/app/entrypoint.sh"] + diff --git a/crm/dev_settings.py b/crm/dev_settings.py new file mode 100644 index 00000000..2dbbd807 --- /dev/null +++ b/crm/dev_settings.py @@ -0,0 +1,15 @@ +from .settings import * + +# Database +# https://docs.djangoproject.com/en/1.11/ref/settings/#databases +ALLOWED_HOSTS = ['*'] + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql', + 'NAME': 'postgres', + 'USER': 'postgres', + 'HOST': 'db', + 'PORT': 5432, + } +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..d362dc60 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +version: '1.0' + +services: + db: + image: postgres + volumes: + - /home/db:/var/lib/postgresql/data + dockertest: + build: . + image: micropyramid/django-crm:1 + environment: + - DJANGO_SETTINGS_MODULE=crm.dev_settings + ports: + - "8000:8000" + depends_on: + - db \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 00000000..d4f4a117 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Install dependencies +pip install -r requirements.txt + + +# Execute startup scripts +python manage.py collectstatic --noinput +python manage.py migrate +python manage.py runserver 0.0.0.0:8000