github.com/ddev/ddev@v1.23.2-0.20240519125000-d824ffe36ff3/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  # Debian Stretch archives have been turned off
    18  RUN if grep "Debian GNU/Linux 9" /etc/issue >/dev/null ; then \
    19      echo "deb http://archive.debian.org/debian/ stretch main contrib non-free" >/etc/apt/sources.list; \
    20      fi
    21  # Remove obsolete MySQL 5.5/5.6 Jessie and before keys so they don't make expiration key test stumble
    22  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 \
    23      apt-key remove "${item}" || true; \
    24    done;
    25  
    26  # Older versions of mariadb have been removed from
    27  # the mariadb apt repository, so we don't want to
    28  # look there when doing apt-get update. And we don't use new packages from there.
    29  # And we're going to install our own percona.list if needed, so get that if needed
    30  # and remove it here
    31  RUN rm -f /etc/apt/sources.list.d/mariadb.list /etc/apt/sources.list.d/percona.list
    32  
    33  RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confold" bzip2 curl gnupg2 less lsb-release pv tzdata vim wget
    34  
    35  # If on 14.04 Ubuntu the percona repositories won't allow TLS apparently, so
    36  # Use http when connecting. This currently only affects MariaDB 5.5
    37  RUN set -x; if ( ! command -v xtrabackup && ! command -v mariabackup && [ $(arch) != "aarch64" ] ); then \
    38      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; \
    39      dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb >/dev/null; \
    40      rm percona-release*.deb ; \
    41      xtrabackup_version=percona-xtrabackup-24 ; \
    42      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; \
    43      if [ "$DB_VERSION" = "8.0" ]; then xtrabackup_version=percona-xtrabackup-80; fi ; \
    44      apt-get -qq update && apt-get -qq install -y ${xtrabackup_version} >/dev/null ; \
    45  fi
    46  RUN apt-get -qq autoclean
    47  
    48  RUN rm -rf /var/lib/mysql /etc/mysql
    49  RUN mkdir -p /var/lib/mysql
    50  
    51  ADD files /
    52  
    53  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
    54  RUN ln -s -f /dev/stderr /var/log/mysqld.err
    55  
    56  # Build a starter base db
    57  RUN /create_base_db.sh
    58  
    59  RUN chmod ugo+x /healthcheck.sh
    60  
    61  # But make sure these are right
    62  RUN chmod ugo+wx /mnt /var/tmp
    63  
    64  RUN rm -rf /var/lib/mysql/*
    65  RUN chmod -R ugo+rw /var/lib/mysql /etc/mysql/conf.d /mysqlbase && find /mysqlbase -type d | xargs chmod ugo+rwx
    66  
    67  RUN mkdir -p /var/run/mysqld && chmod 777 /var/run/mysqld
    68  
    69  RUN /sbin/mkhomedir_helper www-data
    70  
    71  # Remove the /etc/apt entry so that if they don't renew the key
    72  # apt-get update will continue to function
    73  # Remove MySQL published key that expires 2022-02-15
    74  # Have requested them to update this in https://bugs.mysql.com/bug.php?id=105632
    75  # But they haven't done it, and it will break things when it expires.
    76  RUN rm -f /etc/apt/sources.list.d/mysql.list && \
    77    for item in "A4A9 4068 76FC BD3C 4567  70C8 8C71 8D3B 5072 E1F5" ; do \
    78      apt-key remove "${item}" || true; \
    79    done;
    80  
    81  # Normal upstream image doesn't actually have /home/mysql created
    82  # Make sure it's there in case user 999 (mysql) is using this image.
    83  RUN mkdir /home/mysql && chown mysql:mysql /home/mysql
    84  
    85  ENTRYPOINT ["/docker-entrypoint.sh"]
    86  
    87  EXPOSE 3306
    88  # The following line overrides any cmd entry
    89  CMD []
    90  HEALTHCHECK --interval=1s --retries=30 --timeout=120s CMD ["/healthcheck.sh"]