Move to Docker Compose and multiple containers

This commit is contained in:
Pierre Jaury
2016-02-24 07:44:49 +01:00
parent caab793716
commit d0006dc624
33 changed files with 260 additions and 175 deletions

12
admin/Dockerfile Normal file
View File

@@ -0,0 +1,12 @@
FROM python:3
RUN mkdir -p /app
WORKDIR /app
COPY freeposte ./freeposte
COPY initdb.py .
COPY requirements.txt .
RUN pip install -r requirements.txt
CMD gunicorn -w 4 -b 0.0.0.0:80 --access-logfile - --error-logfile - freeposte:app

View File

@@ -10,7 +10,8 @@ app = Flask(__name__)
default_config = {
'SQLALCHEMY_DATABASE_URI': 'sqlite:////data/freeposte.db',
'SQLALCHEMY_TRACK_MODIFICATIONS': False,
'SECRET_KEY': None
'SECRET_KEY': None,
'DEBUG': False
}
# Load configuration from the environment if available
@@ -21,4 +22,9 @@ for key, value in default_config.items():
# Create the database
db = SQLAlchemy(app)
from freeposte import views
# Import views and models
from freeposte import models, views
# Manage database upgrades if necessary
db.create_all()
db.session.commit()

View File

@@ -3,9 +3,11 @@ from flask_admin.contrib import sqla
from freeposte import app, db, models
import os
# Flask admin
admin = admin.Admin(app, name='Freeposte.io', template_mode='bootstrap3')
app_name = os.environ.get('APP_NAME', 'Freeposte.io')
admin = admin.Admin(app, name=app_name, template_mode='bootstrap3')
class BaseModelView(sqla.ModelView):

View File

@@ -1,4 +1,4 @@
Flask
Flask-Admin
Flask-SQLAlchemy
uwsgi
gunicorn