Skip to content

Commit 9d65fa1

Browse files
committed
2023-02-14 MariaDB Dockerfile - old-menu branch - PR 2 of 3
Adjusts Dockerfile to cope with rename of internal file path `/defaults/my.cnf` to `/defaults/custom.cnf`. Strategy is to check for the presence of both files and then apply the stability patches to the first match. This should mean that the Dockerfile is backwards compatible with images that use `my.cnf`. Signed-off-by: Phill Kelley <[email protected]>
1 parent 6eaec7a commit 9d65fa1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

.templates/mariadb/Dockerfile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
# Download base image
22
FROM ghcr.io/linuxserver/mariadb
33

4+
# candidates for customisation are
5+
ENV CANDIDATES="/defaults/my.cnf /defaults/custom.cnf"
6+
47
# apply stability patches recommended in
58
#
69
# https://discord.com/channels/638610460567928832/638610461109256194/825049573520965703
710
# https://stackoverflow.com/questions/61809270/how-to-discover-why-mariadb-crashes
8-
RUN sed -i.bak \
9-
-e "s/^thread_cache_size/# thread_cache_size/" \
10-
-e "s/^read_buffer_size/# read_buffer_size/" \
11-
/defaults/my.cnf
11+
RUN for CNF in ${CANDIDATES} ; do [ -f ${CNF} ] && break ; done ; \
12+
sed -i.bak \
13+
-e "s/^thread_cache_size/# thread_cache_size/" \
14+
-e "s/^read_buffer_size/# read_buffer_size/" \
15+
${CNF}
1216

1317
# copy the health-check script into place
1418
ENV HEALTHCHECK_SCRIPT "iotstack_healthcheck.sh"
@@ -22,4 +26,6 @@ HEALTHCHECK \
2226
--retries=3 \
2327
CMD ${HEALTHCHECK_SCRIPT} || exit 1
2428

29+
ENV CANDIDATES=
30+
2531
# EOF

0 commit comments

Comments
 (0)