diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e8b2aaf --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +var/ +venv/ +*.egg-info/ +dist/ +.idea +.DS_Store +.vscode +build/ +__pycache__/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 49912ea..09150d1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,7 @@ var/ venv/ *.egg-info/ -node_modules/ dist/ -birdsongtestbed/static *.pyc *.local .tmp diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 0000000..1ac52b2 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,20 @@ +FROM python:3.6 + +WORKDIR /srv + +ENV PYTHONUNBUFFERED=1 \ + PYTHONIOENCODING=UTF-8 \ + PYTHONDONTWRITEBYTECODE=1 \ + LC_ALL=C.UTF-8 \ + LANG=C.UTF-8 \ + PYTHONPATH=/srv/ \ + DJANGO_SETTINGS_MODULE=settings_dev \ + DJANGO_SUPERUSER_PASSWORD=p + +COPY . /srv/ + +RUN pip install -e . +RUN django-admin migrate +RUN django-admin createsuperuser --no-input --username admin --email admin@email.com + +CMD [ "django-admin" , "runserver", "0.0.0.0:8080"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9f1a2c8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,26 @@ +version: "3" + +services: + birdsong: + build: + context: . + dockerfile: Dockerfile.dev + restart: always + command: django-admin runserver 0.0.0.0:8080 + links: + - mjml + ports: + - "8080:8080" + container_name: 'birdsong_dev' + working_dir: '/srv' + volumes: + - './tests:/srv/tests' + - './birdsong:/srv/birdsong' + - './settings_dev.py:/srv/settings_dev.py' + # - './local.sqlite3:/srv/local.sqlite3' + + mjml: + image: liminspace/mjml-tcpserver:latest + restart: always + ports: + - "28101" diff --git a/manage.py b/manage.py deleted file mode 100755 index 1c391d8..0000000 --- a/manage.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python3.6 - -import os -import shutil -import sys - - -def run(): - from django.core.management import execute_from_command_line - - os.environ['DJANGO_SETTINGS_MODULE'] = 'settings_dev' - args = sys.argv[:] - if len(args) == 2 and sys.argv[1] == 'runserver': - # Default to serving externally if not told otherwise - args = sys.argv + ['0.0.0.0:8080'] - - execute_from_command_line(args) - - -if __name__ == '__main__': - run() diff --git a/settings_dev.py b/settings_dev.py index 22cc1af..0ebed0d 100644 --- a/settings_dev.py +++ b/settings_dev.py @@ -8,4 +8,9 @@ DATABASES = { }, } -ALLOWED_HOSTS = ['*'] \ No newline at end of file +ALLOWED_HOSTS = ['*'] + +MJML_BACKEND_MODE = 'tcpserver' +MJML_TCPSERVERS = [ + ('mjml', 28101), # host and port +] \ No newline at end of file