You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.3 KiB

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