moved django inside new directoy for docker organization.
This commit is contained in:
parent
c427545b6c
commit
dbd94e071a
18
Dockerfile
18
Dockerfile
@ -20,22 +20,22 @@ RUN apt-get -y install mysql-server
|
|||||||
|
|
||||||
|
|
||||||
# Add and install Python modules
|
# 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
|
RUN cd /roadmap; pip install -r requirements.txt
|
||||||
|
|
||||||
# Bundle app source
|
# 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
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
EXPOSE 3306
|
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://txt.fliglio.com/2013/11/creating-a-mysql-docker-container/
|
||||||
# http://blogs.aws.amazon.com/application-management/post/Tx1ZLAHMVBEDCOC/Dockerizing-a-Python-Web-App
|
# http://blogs.aws.amazon.com/application-management/post/Tx1ZLAHMVBEDCOC/Dockerizing-a-Python-Web-App
|
||||||
|
16
startup.sh
Executable file
16
startup.sh
Executable 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 &
|
Loading…
Reference in New Issue
Block a user