Streamlining docker-compose process

This commit is contained in:
Kevin Chung
2016-11-10 15:35:59 -05:00
parent 70e7599439
commit f1bf2fd4e5
2 changed files with 8 additions and 29 deletions

View File

@@ -1,17 +0,0 @@
#!/bin/sh
sed "s;sqlite:///ctfd.db;mysql+pymysql://${MYSQL_USER}:${MYSQL_PASSWORD}@db/ctfd;g" CTFd/config.py -i
# wait for mysql to start
cnt=0
while ! nc db 3306 >/dev/null 2>&1 < /dev/null; do
if [ $cnt -ge 50 ]; then
echo "$(date) - db:3306 still not reachable, giving up"
exit 1
fi
echo "$(date) - waiting for db:3306..."
sleep 1
cnt=`expr $cnt + 1`
done
gunicorn --bind 0.0.0.0:8000 -w 4 "CTFd:create_app()"

View File

@@ -1,28 +1,24 @@
ctfd:
build: .
restart: always
restart: always
ports:
- "8000:8000"
environment:
- &MU MYSQL_USER=ctfd
- &MP MYSQL_PASSWORD=You_Should_Probably_Override_This
- &MD MYSQL_DATABASE=ctfd
command: sh docker-compose-run.sh
- DATABASE_URL=mysql+pymysql://root@db/ctfd
volumes_from:
- data:rw
links:
- db
- db:db
db:
image: mariadb
image: mysql
environment:
- *MU
- *MP
- *MD
- MYSQL_ROOT_PASSWORD=Unencrypted_Credentials_At_Rest
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
volumes_from:
- data:rw
data:
image: mariadb
image: mysql
restart: always
volumes:
- /var/lib/mysql