web: | web: | ||||
build: ./web | build: ./web | ||||
container_name: python | container_name: python | ||||
ports: | |||||
- "5000:5000" | |||||
volumes: | |||||
- ./web:/code | |||||
expose: | |||||
- 5000 | |||||
env_file: | env_file: | ||||
- ./.env.prod | - ./.env.prod | ||||
depends_on: | |||||
- db | |||||
command: gunicorn --workers=3 --bind 0.0.0.0:5000 "app:create_app()" | |||||
db: | db: | ||||
image: mariadb:latest | image: mariadb:latest | ||||
env_file: | env_file: | ||||
- ./.env.prod | - ./.env.prod | ||||
volumes: | volumes: | ||||
dbdata:/var/lib/mysql | |||||
- dbdata:/var/lib/mysql | |||||
command: '--default-authentication-plugin=mysql_native_password' | command: '--default-authentication-plugin=mysql_native_password' | ||||
nginx: | |||||
image: nginx:latest | |||||
container_name: nginx | |||||
restart: unless-stopped | |||||
ports: | |||||
- "1337:80" | |||||
volumes: | |||||
- ./nginx-conf:/etc/nginx/conf.d | |||||
depends_on: | |||||
- web | |||||
volumes: | |||||
dbdata: |
upstream toolkit { | |||||
server web:5000; | |||||
} | |||||
server { | |||||
listen 80; | |||||
location / { | |||||
proxy_pass http://toolkit; | |||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |||||
proxy_set_header Host $host; | |||||
proxy_redirect off; | |||||
} | |||||
} |
# get config variables from OS environment variables: set in env file passed through Docker Compose | # get config variables from OS environment variables: set in env file passed through Docker Compose | ||||
app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY') | app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY') | ||||
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL') | app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL') | ||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = 'False' | |||||
db.init_app(app) | db.init_app(app) | ||||
flask-sqlalchemy | flask-sqlalchemy | ||||
flask-login | flask-login | ||||
flask-moment | flask-moment | ||||
gunicorn |