Public | Automated Build

Last pushed: 3 years ago
Dockerfile
# # "MySQL" base by Luispa, Dec 2014 # # ----------------------------------------------------- # # Desde donde parto... # FROM debian:jessie # Autor de este Dockerfile # MAINTAINER Luis Palacios <luis@luispa.com> # Pido que el frontend de Debian no sea interactivo ENV DEBIAN_FRONTEND noninteractive # ------- ------- ------- ------- ------- ------- ------- # Básico # ------- ------- ------- ------- ------- ------- ------- # Actualizo el sistema operativo e instalo lo mínimo # RUN apt-get update && \ apt-get -y install locales \ net-tools \ vim \ supervisor \ wget \ curl \ rsyslog # Preparo locales y Timezone # RUN locale-gen es_ES.UTF-8 RUN locale-gen en_US.UTF-8 RUN dpkg-reconfigure locales RUN echo "Europe/Madrid" > /etc/timezone; dpkg-reconfigure -f noninteractive tzdata # Workaround para el Timezone, en vez de montar el fichero en modo read-only: # 1) En el DOCKERFILE RUN mkdir -p /config/tz && mv /etc/timezone /config/tz/ && ln -s /config/tz/timezone /etc/ # 2) En el Script entrypoint: # if [ -d '/config/tz' ]; then # dpkg-reconfigure -f noninteractive tzdata # echo "Hora actual: `date`" # fi # 3) Al arrancar el contenedor, montar el volumen, a contiuación un ejemplo: # /Apps/data/tz:/config/tz # 4) Localizar la configuración: #  echo "Europe/Madrid" > /Apps/data/tz/timezone # ------- ------- ------- ------- ------- ------- ------- ------- # MySQL # # Fuente: https://github.com/docker-library/mysql/tree/master/5.6 # # ------- ------- ------- ------- ------- ------- ------- ------- # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql # FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: # File::Basename # File::Copy # Sys::Hostname # Data::Dumper RUN apt-get update && apt-get install -y perl --no-install-recommends && rm -rf /var/lib/apt/lists/* # gpg: key 5072E1F5: public key "MySQL Release Engineering <mysql-build@oss.oracle.com>" imported RUN apt-key adv --keyserver pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 ENV MYSQL_MAJOR 5.6 ENV MYSQL_VERSION 5.6.24 RUN echo "deb http://repo.mysql.com/apt/debian/ wheezy mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list # the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) # also, we set debconf keys to make APT a little quieter RUN { \ echo mysql-community-server mysql-community-server/data-dir select ''; \ echo mysql-community-server mysql-community-server/root-pass password ''; \ echo mysql-community-server mysql-community-server/re-root-pass password ''; \ echo mysql-community-server mysql-community-server/remove-test-db select false; \ } | debconf-set-selections \ && apt-get update && apt-get install -y mysql-server="${MYSQL_VERSION}"* && rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql # comment out a few problematic configuration values RUN sed -Ei 's/^(bind-address|log)/#&/' /etc/mysql/my.cnf # Directorio al que conmuto... WORKDIR /usr/local/mysql # Soy MySQL, tendré que escuchar no? :) EXPOSE 3306 # ------- ------- ------- ------- ------- ------- ------- # DEBUG ( Descomentar durante debug del contenedor ) # ------- ------- ------- ------- ------- ------- ------- # # Herramientas SSH, tcpdump y net-tools #RUN apt-get update && \ # apt-get -y install openssh-server \ # tcpdump \ # net-tools ## Setup de SSHD #RUN mkdir /var/run/sshd #RUN echo 'root:docker' | chpasswd #RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config #RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd #ENV NOTVISIBLE "in users profile" #RUN echo "export VISIBLE=now" >> /etc/profile ## Script que uso a menudo durante las pruebas. Es como "cat" pero elimina líneas de comentarios RUN echo "grep -vh '^[[:space:]]*#' \"\$@\" | grep -v '^//' | grep -v '^;' | grep -v '^\$' | grep -v '^\!' | grep -v '^--'" > /usr/bin/confcat RUN chmod 755 /usr/bin/confcat #----------------------------------------------------------------------------------- # Ejecutar siempre al arrancar el contenedor este script # ADD do.sh /do.sh RUN chmod +x /do.sh ENTRYPOINT ["/do.sh"] # # Si no se especifica nada se ejecutará lo siguiente: # CMD ["/usr/bin/supervisord", "-n -c /etc/supervisor/supervisord.conf"]
Source Repository