Add a production capable docker-compose file.

This commit is contained in:
FireMasterK 2020-09-08 18:15:10 +05:30
parent 70fcc42a6b
commit 8caf9d4763
No known key found for this signature in database
GPG Key ID: 8DFF5DD33E93DB58
3 changed files with 37 additions and 2 deletions

View File

@ -1,2 +1,7 @@
.git
.gitignore
Dockerfile
docker-compose.yml
LICENSE
*.md
yotter-config.json

View File

@ -15,5 +15,7 @@ RUN flask db init \
&& flask db migrate \
&& flask db upgrade
CMD [ "gunicorn", "-b", "0.0.0.0:5000", "-w", "4", "yotter:app" ]
CMD flask db upgrade \
&& gunicorn -b 0.0.0.0:5000 -w 4 yotter:app
EXPOSE 5000

28
docker-compose.yml Normal file
View File

@ -0,0 +1,28 @@
version: '3.4'
services:
mariadb:
image: mariadb:latest
environment:
MYSQL_ROOT_PASSWORD: changeme
MYSQL_DATABASE: yotter
MYSQL_USER: yotter
MYSQL_PASSWORD: changeme
restart: on-failure
volumes:
- /var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "--silent"]
yotter:
image: yotter
restart: unless-stopped
ports:
- "127.0.0.1:5000:5000"
environment:
DATABASE_URL: mysql+pymysql://yotter:changeme@mariadb:3306/yotter
depends_on:
- mariadb
ports:
- "5000:5000"
volumes:
- /usr/src/app/migrations
- ./yotter-config.json:/usr/src/app/yotter-config.json