Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Simoneu01 authored Jan 14, 2024
1 parent d4b95c7 commit cb9c494
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ ENV DEBIAN_FRONTEND=noninteractive
ENV RUNNER_MANUALLY_TRAP_SIG=1
ENV ACTIONS_RUNNER_PRINT_LOG_TO_STDOUT=1
ENV ImageOS=ubuntu22
ENV ACCEPT_EULA=Y
ENV MYSQL_ROOT_PASSWORD=root

RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
Expand All @@ -49,12 +51,40 @@ RUN apt-get update -y \
unzip \
gpg \
&& rm -rf /var/lib/apt/lists/*

# Install MariaDB
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
mariadb-server \
&& rm -rf /var/lib/apt/lists/*

ARG MARIADB_VERSION=1:11.4.0+maria~ubu2204
ENV MARIADB_VERSION $MARIADB_VERSION

# Mysql setting up root password
RUN set -ex; \
{ \
echo "mariadb-server" mysql-server/root_password password 'unused'; \
echo "mariadb-server" mysql-server/root_password_again password 'unused'; \
} | debconf-set-selections; \
apt-get update; \
# postinst script creates a datadir, so avoid creating it by faking its existance.
mkdir -p /var/lib/mysql/mysql ; touch /var/lib/mysql/mysql/user.frm ; \
# mariadb-backup is installed at the same time so that `mysql-common` is only installed once from just mariadb repos
apt-get install -y --no-install-recommends mariadb-server="$MARIADB_VERSION" mariadb-backup socat \
; \
rm -rf /var/lib/apt/lists/*; \
# purge and re-create /var/lib/mysql with appropriate ownership
rm -rf /var/lib/mysql /etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf; \
mkdir -p /var/lib/mysql /run/mysqld; \
chown -R mysql:mysql /var/lib/mysql /run/mysqld; \
# ensure that /run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime
chmod 1777 /run/mysqld; \
# comment out a few problematic configuration values
find /etc/mysql/ -name '*.cnf' -print0 \
| xargs -0 grep -lZE '^(bind-address|log|user\s)' \
| xargs -rt -0 sed -Ei 's/^(bind-address|log|user\s)/#&/'; \
# don't reverse lookup hostnames, they are usually another container
printf "[mariadb]\nhost-cache-size=0\nskip-name-resolve\n" > /etc/mysql/mariadb.conf.d/05-skipcache.cnf; \
# Issue #327 Correct order of reading directories /etc/mysql/mariadb.conf.d before /etc/mysql/conf.d (mount-point per documentation)
if [ -L /etc/mysql/my.cnf ]; then \
# 10.5+
sed -i -e '/includedir/ {N;s/\(.*\)\n\(.*\)/\n\2\n\1/}' /etc/mysql/mariadb.cnf; \
fi

# Configure MariaDB
RUN echo 'sort_buffer_size = 256000000' >> /etc/mysql/mariadb.conf.d/50-server.cnf
Expand Down

0 comments on commit cb9c494

Please sign in to comment.