github.com/drud/ddev@v1.21.5-alpha1.0.20230226034409-94fcc4b94453/containers/ddev-dbserver/Dockerfile (about) 1 ARG BASE_IMAGE 2 ARG DB_PINNED_VERSION 3 FROM ${BASE_IMAGE}:${DB_PINNED_VERSION} 4 5 # This must be reiterated because everything is emptied on FROM 6 ARG BASE_IMAGE 7 ARG DB_VERSION 8 9 ENV LANG=C.UTF-8 10 ENV MYSQL_DATABASE db 11 ENV MYSQL_USER db 12 ENV MYSQL_PASSWORD db 13 ENV MYSQL_ROOT_PASSWORD root 14 15 SHELL ["/bin/bash", "-c"] 16 17 # Remove obsolete MySQL 5.5/5.6 Jessie and before keys so they don't make expiration key test stumble 18 RUN for item in "75DD C3C4 A499 F1A1 8CB5 F3C8 CBF8 D6FD 518E 17E1" "126C 0D24 BD8A 2942 CC7D F8AC 7638 D044 2B90 D010" "D211 6914 1CEC D440 F2EB 8DDA 9D6D 8F6B C857 C906" "A1BD 8E9D 78F7 FE5C 3E65 D8AF 8B48 AD62 4692 5553" "ED6D 6527 1AAC F0FF 15D1 2303 6FB2 A1C2 65FF B764"; do \ 19 apt-key remove "${item}" || true; \ 20 done; 21 22 # Older versions of mariadb have been removed from 23 # the mariadb apt repository, so we don't want to 24 # look there when doing apt-get update. And we don't use new packages from there. 25 # And we're going to install our own percona.list if needed, so get that if needed 26 # and remove it here 27 RUN rm -f /etc/apt/sources.list.d/mariadb.list /etc/apt/sources.list.d/percona.list 28 29 RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y -o Dpkg::Options::="--force-confold" curl gnupg2 less lsb-release pv tzdata vim wget >/dev/null 30 31 # If on 14.04 Ubuntu the percona repositories won't allow TLS apparently, so 32 # Use http when connecting. This currently only affects MariaDB 5.5 33 RUN set -x; if ( ! command -v xtrabackup && ! command -v mariabackup && [ $(arch) != "aarch64" ] ); then \ 34 curl --fail -sSL https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb -o percona-release_latest.$(lsb_release -sc)_all.deb; \ 35 dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb >/dev/null; \ 36 rm percona-release*.deb ; \ 37 xtrabackup_version=percona-xtrabackup-24 ; \ 38 if [ "$(lsb_release -i -s)" = "Ubuntu" ] && "$(lsb_release -r -s)" <= "16.04" ]; then sed -i s/https:/http:/g /etc/apt/sources.list.d/percona.list; fi; \ 39 if [ "$DB_VERSION" = "8.0" ]; then xtrabackup_version=percona-xtrabackup-80; fi ; \ 40 apt-get -qq update && apt-get -qq install -y ${xtrabackup_version} >/dev/null ; \ 41 fi 42 RUN apt-get -qq autoclean 43 44 RUN rm -rf /var/lib/mysql /etc/mysql 45 RUN mkdir -p /var/lib/mysql 46 47 ADD files / 48 49 # Build a starter base db 50 RUN /create_base_db.sh 51 52 RUN chmod ugo+x /healthcheck.sh 53 54 # But make sure these are right 55 RUN chmod ugo+wx /mnt /var/tmp 56 57 RUN mkdir -p /var/log /var/tmp/mysqlbase /etc/mysql/conf.d && chmod -R ugo+wx /var/log /var/tmp/mysqlbase /etc/mysql/conf.d 58 RUN ln -s -f /dev/stderr /var/log/mysqld.err 59 60 RUN rm -rf /var/lib/mysql/* 61 RUN chmod -R ugo+rw /var/lib/mysql /etc/mysql/conf.d /mysqlbase && find /mysqlbase -type d | xargs chmod ugo+rwx 62 63 RUN mkdir -p /var/run/mysqld && chmod 777 /var/run/mysqld 64 65 RUN /sbin/mkhomedir_helper www-data 66 67 # Remove the /etc/apt entry so that if they don't renew the key 68 # apt-get update will continue to function 69 # Remove MySQL published key that expires 2022-02-15 70 # Have requested them to update this in https://bugs.mysql.com/bug.php?id=105632 71 # But they haven't done it, and it will break things when it expires. 72 RUN rm -f /etc/apt/sources.list.d/mysql.list && \ 73 for item in "A4A9 4068 76FC BD3C 4567 70C8 8C71 8D3B 5072 E1F5" ; do \ 74 apt-key remove "${item}" || true; \ 75 done; 76 77 # Normal upstream image doesn't actually have /home/mysql created 78 # Make sure it's there in case user 999 (mysql) is using this image. 79 RUN mkdir /home/mysql && chown mysql:mysql /home/mysql 80 81 ENTRYPOINT ["/docker-entrypoint.sh"] 82 83 EXPOSE 3306 84 # The following line overrides any cmd entry 85 CMD [] 86 HEALTHCHECK --interval=1s --retries=30 --timeout=120s CMD ["/healthcheck.sh"]