moved django inside new directoy for docker organization.

This commit is contained in:
Tyrel Souza 2015-03-11 23:32:08 -04:00
parent c427545b6c
commit dbd94e071a
19 changed files with 25 additions and 9 deletions

View File

@ -20,22 +20,22 @@ RUN apt-get -y install mysql-server
# Add and install Python modules
ADD requirements.txt /roadmap/requirements.txt
ADD roadmap/requirements.txt /roadmap/requirements.txt
RUN cd /roadmap; pip install -r requirements.txt
# Bundle app source
ADD . /roadmap
ADD roadmap /roadmap
ADD startup.sh /opt/startup.sh
# Change Mysql BindAddress
RUN sed -i -e"s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/my.cnf
RUN /bin/bash /opt/startup.sh
RUN cd /roadmap; python manage.py migrate
# Expose
EXPOSE 8000
EXPOSE 3306
# Run
CMD ["/usr/bin/mysqld_safe"]
CMD ["python", "/roadmap/manage.py", "test"]
# http://txt.fliglio.com/2013/11/creating-a-mysql-docker-container/
# http://blogs.aws.amazon.com/application-management/post/Tx1ZLAHMVBEDCOC/Dockerizing-a-Python-Web-App

16
startup.sh Executable file
View File

@ -0,0 +1,16 @@
#/bin/bash
if [ ! -f /var/lib/mysql/roadmap ]; then
mysql_install_db
/usr/bin/mysqld_safe &
sleep 10s
echo "GRANT ALL ON *.* TO django@'%' IDENTIFIED BY 'django' WITH GRANT OPTION; FLUSH PRIVILEGES" | mysql
echo "CREATE DATABASE roadmap" | mysql
killall mysqld
sleep 10s
fi
/usr/bin/mysqld_safe &