Skip to content

Commit 6a6508a

Browse files
committed
simplerisk-minimal: use mysql 8.4
1 parent 64c15b3 commit 6a6508a

3 files changed

Lines changed: 23 additions & 9 deletions

File tree

simplerisk-minimal/Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,15 @@ WORKDIR /var/www
1919
SHELL [ "/bin/bash", "-o", "pipefail", "-c" ]
2020

2121
# Install required packages, including MySQL client from Debian repos
22-
RUN apt-get update && \
22+
RUN mkdir -p /etc/apt/keyrings && \
23+
apt-get update && \
24+
apt-get install -y --no-install-recommends gnupg2 wget lsb-release && \
25+
mkdir -p /etc/apt/keyrings && \
26+
export GNUPGHOME="$(mktemp -d)" && \
27+
gpg --batch --keyserver keys.gnupg.net --recv-keys B7B3B788A8D3785C && \
28+
gpg --batch --export B7B3B788A8D3785C > /etc/apt/trusted.gpg.d/mysql.gpg && \
29+
echo "deb [signed-by=/etc/apt/trusted.gpg.d/mysql.gpg] http://repo.mysql.com/apt/debian/ trixie mysql-8.4-lts" | tee /etc/apt/sources.list.d/mysql.list && \
30+
apt-get update && \
2331
apt-get install -y --no-install-recommends \
2432
libldap2-dev \
2533
libicu-dev \
@@ -33,8 +41,7 @@ RUN apt-get update && \
3341
rsyslog \
3442
logrotate \
3543
curl \
36-
# This will install mariadb-client
37-
default-mysql-client && \
44+
mysql-community-client && \
3845
apt-get -y autoremove && \
3946
apt-get -y purge && \
4047
rm -rf /var/lib/apt/lists/*

simplerisk-minimal/common/entrypoint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ delete_db(){
108108
print_log "db_deletion: prepare" "Performing database deletion"
109109

110110
# Needed to separate the GRANT statement from the rest because it was providing a syntax error
111-
exec_cmd "mysql --skip-ssl -u $DB_SETUP_USER -p$DB_SETUP_PASS -h$SIMPLERISK_DB_HOSTNAME -P$SIMPLERISK_DB_PORT <<EOSQL
111+
exec_cmd "mysql -u $DB_SETUP_USER -p$DB_SETUP_PASS -h$SIMPLERISK_DB_HOSTNAME -P$SIMPLERISK_DB_PORT <<EOSQL
112112
SET sql_mode = 'ANSI_QUOTES';
113113
DROP DATABASE \"${SIMPLERISK_DB_DATABASE}\";
114114
USE mysql;
@@ -138,15 +138,15 @@ db_setup(){
138138

139139
print_log "initial_setup:info" "Applying changes to MySQL database... (MySQL error will be printed to console as guidance)"
140140
# Using sql_mode = ANSI_QUOTES to avoid using backticks
141-
exec_cmd "mysql --skip-ssl -u $DB_SETUP_USER -p$DB_SETUP_PASS -h$SIMPLERISK_DB_HOSTNAME -P$SIMPLERISK_DB_PORT <<EOSQL
141+
exec_cmd "mysql -u $DB_SETUP_USER -p$DB_SETUP_PASS -h$SIMPLERISK_DB_HOSTNAME -P$SIMPLERISK_DB_PORT <<EOSQL
142142
SET sql_mode = 'ANSI_QUOTES';
143143
CREATE DATABASE \"${SIMPLERISK_DB_DATABASE}\";
144144
USE \"${SIMPLERISK_DB_DATABASE}\";
145145
\. ${SCHEMA_FILE}
146146
CREATE USER \"${SIMPLERISK_DB_USERNAME}\"@\"%\" IDENTIFIED BY \"${SIMPLERISK_DB_PASSWORD}\";
147147
EOSQL" "Was not able to apply settings on database. Check error above. Exiting."
148148
# Needed to separate the GRANT statement from the rest because it was providing a syntax error
149-
exec_cmd "mysql --skip-ssl -u $DB_SETUP_USER -p$DB_SETUP_PASS -h$SIMPLERISK_DB_HOSTNAME -P$SIMPLERISK_DB_PORT <<EOSQL
149+
exec_cmd "mysql -u $DB_SETUP_USER -p$DB_SETUP_PASS -h$SIMPLERISK_DB_HOSTNAME -P$SIMPLERISK_DB_PORT <<EOSQL
150150
SET sql_mode = 'ANSI_QUOTES';
151151
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER ON \"${SIMPLERISK_DB_DATABASE}\".* TO \"${SIMPLERISK_DB_USERNAME}\"@\"%\";
152152
EOSQL" "Was not able to apply settings on database. Check error above. Exiting."

simplerisk-minimal/generate_dockerfile.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ WORKDIR /var/www
4141
SHELL [ "/bin/bash", "-o", "pipefail", "-c" ]
4242
4343
# Install required packages, including MySQL client from Debian repos
44-
RUN apt-get update && \\
44+
RUN mkdir -p /etc/apt/keyrings && \\
45+
apt-get update && \\
46+
apt-get install -y --no-install-recommends gnupg2 wget lsb-release && \\
47+
mkdir -p /etc/apt/keyrings && \\
48+
export GNUPGHOME="\$(mktemp -d)" && \\
49+
gpg --batch --keyserver keys.gnupg.net --recv-keys B7B3B788A8D3785C && \\
50+
gpg --batch --export B7B3B788A8D3785C > /etc/apt/trusted.gpg.d/mysql.gpg && \\
51+
echo "deb [signed-by=/etc/apt/trusted.gpg.d/mysql.gpg] http://repo.mysql.com/apt/debian/ trixie mysql-8.4-lts" | tee /etc/apt/sources.list.d/mysql.list && \\
52+
apt-get update && \\
4553
apt-get install -y --no-install-recommends \\
4654
libldap2-dev \\
4755
libicu-dev \\
@@ -55,8 +63,7 @@ RUN apt-get update && \\
5563
rsyslog \\
5664
logrotate \\
5765
curl \\
58-
# This will install mariadb-client
59-
default-mysql-client && \\
66+
mysql-community-client && \\
6067
apt-get -y autoremove && \\
6168
apt-get -y purge && \\
6269
rm -rf /var/lib/apt/lists/*

0 commit comments

Comments
 (0)