Dockerfile 1.1 KB

123456789101112131415161718192021222324252627
  1. FROM docker.shemic.com/os/alpine/v3.4:latest
  2. MAINTAINER Rabin "https://github.com/shemic"
  3. USER root
  4. RUN apk add --no-cache --update bash mysql mysql-client && \
  5. mkdir /run/mysqld && chmod 777 /run/mysqld && \
  6. rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql && \
  7. chmod 664 /etc/mysql/my.cnf
  8. RUN sed -Ei 's/^(bind-address|log|binlog)/#&/' /etc/mysql/my.cnf \
  9. #&& sed -Ei 's/^(#skip-networking)/skip-networking/' /etc/mysql/my.cnf \
  10. && echo 'user=root' | awk '{ print } $1 == "[mysqld]" && c == 0 { c = 1; system("cat") }' /etc/mysql/my.cnf > /tmp/my.cnf \
  11. && mv /tmp/my.cnf /etc/mysql/my.cnf \
  12. && echo 'skip-host-cache' | awk '{ print } $1 == "[mysqld]" && c == 0 { c = 1; system("cat") }' /etc/mysql/my.cnf > /tmp/my.cnf \
  13. && mv /tmp/my.cnf /etc/mysql/my.cnf \
  14. && echo 'skip-name-resolve' | awk '{ print } $1 == "[mysqld]" && c == 0 { c = 1; system("cat") }' /etc/mysql/my.cnf > /tmp/my.cnf \
  15. && mv /tmp/my.cnf /etc/mysql/my.cnf
  16. VOLUME ["/var/lib/mysql", "/etc/mysql"]
  17. COPY entrypoint.sh /entrypoint.sh
  18. ENTRYPOINT ["/entrypoint.sh"]
  19. EXPOSE 3306
  20. CMD ["mysqld"]