Dockerfile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #FROM stackbrew/ubuntu:13.10
  2. #FROM stackbrew/ubuntu
  3. FROM stackbrew/ubuntu:saucy
  4. MAINTAINER Meaglith Ma <genedna@gmail.com> (@genedna)
  5. ENV DEBIAN_FRONTEND noninteractive
  6. RUN apt-get install -y --force-yes software-properties-common
  7. RUN add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"
  8. RUN apt-get --yes --force-yes update
  9. RUN apt-get --yes --force-yes upgrade
  10. ENV MYSQL_PASSWORD THE_MYSQL_PASSWORD
  11. RUN echo "mysql-server mysql-server/root_password password $MYSQL_PASSWORD" | debconf-set-selections
  12. RUN echo "mysql-server mysql-server/root_password_again password $MYSQL_PASSWORD" | debconf-set-selections
  13. RUN apt-get update && apt-get install -y --force-yes mysql-server
  14. RUN sed -i -e"s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/my.cnf
  15. RUN service mysql restart
  16. RUN echo "mysql -uroot -p$MYSQL_PASSWORD -e 'drop database if exists gogs;'" >> import.sh
  17. RUN echo "mysql -uroot -p$MYSQL_PASSWORD -e 'create database gogs;'" >> import.sh
  18. RUN chmod +x import.sh
  19. RUN apt-get autoremove -y
  20. RUN apt-get clean all
  21. RUN /usr/sbin/mysqld & \
  22. sleep 10s &&\
  23. echo "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' WITH GRANT OPTION; FLUSH PRIVILEGES" | mysql -p$MYSQL_PASSWORD &&\
  24. ./import.sh
  25. EXPOSE 3306
  26. CMD ["/usr/bin/mysqld_safe", "--skip-syslog", "--log-error=/dev/null"]