Skip to content

Commit

Permalink
Chapter 17: Docker Compose support (17f)
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Feb 1, 2021
1 parent 72f39c7 commit 6c39e8c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ nosetests.xml

# Virtual environment
venv

# Environment files
.env
.env-mysql
11 changes: 10 additions & 1 deletion boot.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
#!/bin/sh
source venv/bin/activate
flask deploy

while true; do
flask deploy
if [[ "$?" == "0" ]]; then
break
fi
echo Deploy command failed, retrying in 5 secs...
sleep 5
done

exec gunicorn -b :5000 --access-logfile - --error-logfile - flasky:app
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3'
services:
flasky:
build: .
ports:
- "8000:5000"
env_file: .env
restart: always
links:
- mysql:dbserver
mysql:
image: "mysql/mysql-server:5.7"
env_file: .env-mysql
restart: always

0 comments on commit 6c39e8c

Please sign in to comment.