Adjustment in Docker stuff to work with new migration. Add init_data.py script to initialize table data

This commit is contained in:
Khanh Ngo
2018-06-11 14:12:04 +07:00
parent ab0124b3e2
commit 232d39cca0
4 changed files with 56 additions and 2 deletions

View File

@ -1,11 +1,17 @@
FROM ubuntu:latest
MAINTAINER Khanh Ngo "ngokhanhit@gmail.com"
MAINTAINER Khanh Ngo "k@ndk.name"
ARG ENVIRONMENT=development
ENV ENVIRONMENT=${ENVIRONMENT}
WORKDIR /powerdns-admin
RUN apt-get update -y
RUN apt-get install -y locales locales-all
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
RUN apt-get install -y python3-pip python3-dev supervisor
# lib for building mysql db driver

View File

@ -1,3 +1,14 @@
#!/bin/sh
cd /powerdns-admin && ./create_db.py
if [ ! -d "/powerdns-admin/migrations" ]; then
/usr/local/bin/flask db init --directory /powerdns-admin/migrations
/usr/local/bin/flask db migrate -m "Init DB" --directory /powerdns-admin/migrations
/usr/local/bin/flask db upgrade --directory /powerdns-admin/migrations
cd /powerdns-admin && ./init_data.py
else
/usr/local/bin/flask db migrate -m "Upgrade BD Schema" --directory /powerdns-admin/migrations
/usr/local/bin/flask db upgrade --directory /powerdns-admin/migrations
fi
/usr/bin/supervisord -c /etc/supervisord.conf