Skip to content

Commit abf6e2c

Browse files
committed
Rebase to 3.21
1 parent 7a07676 commit abf6e2c

File tree

12 files changed

+81
-50
lines changed

12 files changed

+81
-50
lines changed

.github/workflows/external_trigger.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
echo "> [!NOTE]" >> $GITHUB_STEP_SUMMARY
2424
echo "> External trigger running off of master branch. To disable this trigger, add \`mariadb_master\` into the Github organizational variable \`SKIP_EXTERNAL_TRIGGER\`." >> $GITHUB_STEP_SUMMARY
2525
printf "\n## Retrieving external version\n\n" >> $GITHUB_STEP_SUMMARY
26-
EXT_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
26+
EXT_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
2727
&& awk '/^P:'"mariadb"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://')
2828
echo "Type is \`alpine_repo\`" >> $GITHUB_STEP_SUMMARY
2929
if [ -z "${EXT_RELEASE}" ] || [ "${EXT_RELEASE}" == "null" ]; then
@@ -96,7 +96,7 @@ jobs:
9696
if [ "${EXT_RELEASE}" == "${IMAGE_VERSION}" ]; then
9797
echo "Version \`${EXT_RELEASE}\` already pushed, exiting" >> $GITHUB_STEP_SUMMARY
9898
exit 0
99-
elif [[ $(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.20/main/aarch64/APKINDEX.tar.gz" | tar -xz -C /tmp && awk '/^P:'"mariadb"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://') != "${EXT_RELEASE}" ]]; then
99+
elif [[ $(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.21/main/aarch64/APKINDEX.tar.gz" | tar -xz -C /tmp && awk '/^P:'"mariadb"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://') != "${EXT_RELEASE}" ]]; then
100100
echo "New version \`${EXT_RELEASE}\` found; but not all arch repos updated yet; exiting" >> $GITHUB_STEP_SUMMARY
101101
FAILURE_REASON="New version ${EXT_RELEASE} for mariadb tag latest is detected, however not all arch repos are updated yet. Will try again later."
102102
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903,

Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM ghcr.io/linuxserver/baseimage-alpine:3.20
3+
FROM ghcr.io/linuxserver/baseimage-alpine:3.21
44

55
# set version label
66
ARG BUILD_DATE
@@ -11,12 +11,12 @@ LABEL maintainer="thelamer,nemchik"
1111

1212
# environment variables
1313
ENV MYSQL_DIR="/config"
14-
ENV DATADIR=$MYSQL_DIR/databases
14+
ENV DATADIR="$MYSQL_DIR/databases"
1515

1616
RUN \
1717
echo "**** install runtime packages ****" && \
1818
if [ -z ${MARIADB_VERSION+x} ]; then \
19-
MARIADB_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
19+
MARIADB_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
2020
&& awk '/^P:mariadb$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
2121
fi && \
2222
apk add --no-cache \
@@ -26,8 +26,6 @@ RUN \
2626
mariadb-client==${MARIADB_VERSION} \
2727
mariadb-common==${MARIADB_VERSION} \
2828
mariadb-server-utils==${MARIADB_VERSION} && \
29-
mkdir -p \
30-
/var/lib/mysql && \
3129
printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \
3230
echo "**** cleanup ****" && \
3331
rm -rf \

Dockerfile.aarch64

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.20
3+
FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.21
44

55
# set version label
66
ARG BUILD_DATE
@@ -11,12 +11,12 @@ LABEL maintainer="thelamer,nemchik"
1111

1212
# environment variables
1313
ENV MYSQL_DIR="/config"
14-
ENV DATADIR=$MYSQL_DIR/databases
14+
ENV DATADIR="$MYSQL_DIR/databases"
1515

1616
RUN \
1717
echo "**** install runtime packages ****" && \
1818
if [ -z ${MARIADB_VERSION+x} ]; then \
19-
MARIADB_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
19+
MARIADB_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
2020
&& awk '/^P:mariadb$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
2121
fi && \
2222
apk add --no-cache \
@@ -26,8 +26,6 @@ RUN \
2626
mariadb-client==${MARIADB_VERSION} \
2727
mariadb-common==${MARIADB_VERSION} \
2828
mariadb-server-utils==${MARIADB_VERSION} && \
29-
mkdir -p \
30-
/var/lib/mysql && \
3129
printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \
3230
echo "**** cleanup ****" && \
3331
rm -rf \

Jenkinsfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ pipeline {
2727
DEV_DOCKERHUB_IMAGE = 'lsiodev/mariadb'
2828
PR_DOCKERHUB_IMAGE = 'lspipepr/mariadb'
2929
DIST_IMAGE = 'alpine'
30-
DIST_TAG = '3.20'
31-
DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.20/main/'
30+
DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.21/main/'
3231
DIST_REPO_PACKAGES = 'mariadb'
3332
MULTIARCH='true'
3433
CI='true'

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,19 @@ When this container initializes, if `MYSQL_ROOT_PASSWORD` is set an upgrade chec
122122
mariadb-upgrade -u root -p<PASSWORD>
123123
```
124124

125+
## Read-Only Operation
126+
127+
This image can be run with a read-only container filesystem. For details please [read the docs](https://docs.linuxserver.io/misc/read-only/).
128+
129+
### Caveats
130+
131+
* `/tmp` must be mounted to tmpfs
132+
* Not supported on first run
133+
134+
## Non-Root Operation
135+
136+
This image can be run with a non-root user. For details please [read the docs](https://docs.linuxserver.io/misc/non-root/).
137+
125138
## Usage
126139

127140
To help you get started creating a container from this image you can either use docker-compose or the docker cli.
@@ -188,6 +201,8 @@ Containers are configured using parameters passed at runtime (such as those abov
188201
| `-e MYSQL_PASSWORD=DATABASE_PASSWORD` | Set this to the password you want to use for you MYSQL_USER (minimum 4 characters & non-alphanumeric passwords must be properly escaped). (valid only for first run) |
189202
| `-e REMOTE_SQL=http://URL1/your.sql,https://URL2/your.sql` | Set this to ingest sql files from an http/https endpoint (comma seperated array). |
190203
| `-v /config` | Persistent config files |
204+
| `--read-only=true` | Run container with a read-only filesystem. Please [read the docs](https://docs.linuxserver.io/misc/read-only/). |
205+
| `--user=1000:1000` | Run container with a non-root user. Please [read the docs](https://docs.linuxserver.io/misc/non-root/). |
191206

192207
## Environment variables from files (Docker secrets)
193208

@@ -351,6 +366,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
351366

352367
## Versions
353368

369+
* **06.01.25:** - Rebase to Alpine 3.21.
354370
* **31.05.24:** - Rebase to Alpine 3.20.
355371
* **23.12.23:** - Rebase to Alpine 3.19.
356372
* **09.06.23:** - Update lc_messages path in shipped custom.cnf to match upstream.

jenkins-vars.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ repo_vars:
1515
- DEV_DOCKERHUB_IMAGE = 'lsiodev/mariadb'
1616
- PR_DOCKERHUB_IMAGE = 'lspipepr/mariadb'
1717
- DIST_IMAGE = 'alpine'
18-
- DIST_TAG = '3.20'
19-
- DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.20/main/'
18+
- DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.21/main/'
2019
- DIST_REPO_PACKAGES = 'mariadb'
2120
- MULTIARCH='true'
2221
- CI='true'

readme-vars.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ project_url: "https://mariadb.org/"
66
project_logo: "https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/mariadb-git.png"
77
project_blurb: "[{{ project_name|capitalize }}]({{ project_url }}) is one of the most popular database servers. Made by the original developers of MySQL."
88
project_lsio_github_repo_url: "https://github.com/linuxserver/docker-{{ project_name }}"
9-
project_blurb_optional_extras_enabled: false
109
# supported architectures
1110
available_architectures:
1211
- {arch: "{{ arch_x86_64 }}", tag: "amd64-latest"}
@@ -30,6 +29,11 @@ opt_param_env_vars:
3029
- {env_var: "MYSQL_USER", env_value: "MYSQL_USER", desc: "This user will have superuser access to the database specified by MYSQL_DATABASE (do not use root here). (valid only for first run)"}
3130
- {env_var: "MYSQL_PASSWORD", env_value: "DATABASE_PASSWORD", desc: "Set this to the password you want to use for you MYSQL_USER (minimum 4 characters & non-alphanumeric passwords must be properly escaped). (valid only for first run)"}
3231
- {env_var: "REMOTE_SQL", env_value: "http://URL1/your.sql,https://URL2/your.sql", desc: "Set this to ingest sql files from an http/https endpoint (comma seperated array)."}
32+
readonly_supported: true
33+
readonly_message: |
34+
* `/tmp` must be mounted to tmpfs
35+
* Not supported on first run
36+
nonroot_supported: true
3337
# application setup block
3438
app_setup_block_enabled: true
3539
app_setup_block: |
@@ -142,6 +146,7 @@ init_diagram: |
142146
"mariadb:latest" <- Base Images
143147
# changelog
144148
changelogs:
149+
- {date: "06.01.25:", desc: "Rebase to Alpine 3.21."}
145150
- {date: "31.05.24:", desc: "Rebase to Alpine 3.20."}
146151
- {date: "23.12.23:", desc: "Rebase to Alpine 3.19."}
147152
- {date: "09.06.23:", desc: "Update lc_messages path in shipped custom.cnf to match upstream."}

root/defaults/custom.cnf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# especially if they contain "#" chars...
1616
[client]
1717
port = 3306
18-
socket = /var/run/mysqld/mysqld.sock
18+
socket = /run/mysqld/mysqld.sock
1919

2020
default-character-set = utf8mb4
2121

@@ -24,16 +24,16 @@ default-character-set = utf8mb4
2424

2525
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
2626
[mysqld_safe]
27-
socket = /var/run/mysqld/mysqld.sock
27+
socket = /run/mysqld/mysqld.sock
2828
nice = 0
2929

3030
[mysqld]
3131
#
3232
# * Basic Settings
3333
#
3434
user = abc
35-
pid-file = /var/run/mysqld/mysqld.pid
36-
socket = /var/run/mysqld/mysqld.sock
35+
pid-file = /run/mysqld/mysqld.pid
36+
socket = /run/mysqld/mysqld.sock
3737
port = 3306
3838
basedir = /usr
3939
datadir = /var/lib/mysql

root/etc/s6-overlay/s6-rc.d/init-mariadb-config/run

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,9 @@
55
mkdir -p \
66
"${DATADIR}" \
77
/config/log/mysql \
8-
/var/run/mysqld
8+
/run/mysqld
99

10-
# configure mariadb-server.cnf
11-
sed -i "s|.*skip-networking.*|#skip-networking|g" /etc/my.cnf.d/mariadb-server.cnf
12-
13-
# setup custom cnf file
14-
cp -n /defaults/custom.cnf /config/custom.cnf
15-
rm -rf /etc/my.cnf.d/custom.cnf
16-
ln -s /config/custom.cnf /etc/my.cnf.d/custom.cnf
17-
18-
# set permissions
19-
chmod -R 777 \
20-
/var/run/mysqld
10+
# copy custom cnf file
11+
if [[ ! -f /config/custom.cnf ]]; then
12+
cp /defaults/custom.cnf /config/custom.cnf
13+
fi

root/etc/s6-overlay/s6-rc.d/init-mariadb-initdb/run

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
# set start function used later
55
start_mariadb() {
6-
mariadbd --datadir="${DATADIR}" --init-file="${tempSqlFile}" --user=abc &
6+
if [[ -z ${LSIO_NON_ROOT_USER} ]]; then
7+
mariadbd --datadir="${DATADIR}" --init-file="${tempSqlFile}" --pid-file=/run/mysqld/mysqld.pid --user=abc &
8+
else
9+
mariadbd --datadir="${DATADIR}" --init-file="${tempSqlFile}" --pid-file=/run/mysqld/mysqld.pid &
10+
fi
711
pid="$!"
812
RET=1
913
while [[ ${RET} -ne 0 ]]; do
@@ -74,13 +78,17 @@ EONEWSQL
7478
done
7579
fi
7680

77-
# set some permissions needed before we begin
78-
lsiown -R abc:abc "${tempSqlFile}" /config/log/mysql /var/run/mysqld /var/lib/mysql
79-
chmod -R 777 /config/log/mysql /var/run/mysqld /var/lib/mysql
81+
if [[ -z ${LSIO_NON_ROOT_USER} ]]; then
82+
lsiown -R abc:abc "${tempSqlFile}" /config/log/mysql /run/mysqld
83+
chmod -R 777 /config/log/mysql /run/mysqld
84+
fi
8085

8186
# initialise database structure
82-
mariadb-install-db --datadir="${DATADIR}" --user=abc --auth-root-authentication-method=normal
83-
87+
if [[ -z ${LSIO_NON_ROOT_USER} ]]; then
88+
mariadb-install-db --datadir="${DATADIR}" --user=abc --auth-root-authentication-method=normal
89+
else
90+
mariadb-install-db --datadir="${DATADIR}" --auth-root-authentication-method=normal
91+
fi
8492
# start mariadb and apply our sql commands we set above
8593
start_mariadb
8694

@@ -113,6 +121,8 @@ EOFPASS
113121
rm -f "${tempSqlFile}"
114122
fi
115123

116-
# own the folder the pid for mysql runs in
117-
lsiown -R abc:abc /var/run/mysqld
118-
lsiown -R abc:abc /config
124+
if [[ -z ${LSIO_NON_ROOT_USER} ]]; then
125+
# own the folder the pid for mysql runs in
126+
lsiown -R abc:abc /run/mysqld
127+
lsiown -R abc:abc /config
128+
fi

0 commit comments

Comments
 (0)