# Expected build-time mounts:
# - /var/lib/mysql

FROM ubuntu:22.04

RUN apt-get update && apt-get install -y mysql-server

COPY mysqld.cnf /etc/mysql/mysql.conf.d/mysqld.cnf

COPY setup.sql /tmp/setup.sql
RUN service mysql start \
      && cat /tmp/setup.sql | mysql \
      && rm -f /tmp/setup.sql \
      && service mysql stop

RUN chown -R root:root /var/lib/mysql

CMD /usr/bin/mysqld_safe
