Skip to content

Commit b0f4490

Browse files
committed
ubuntu
1 parent 8465e43 commit b0f4490

File tree

3 files changed

+224
-1
lines changed

3 files changed

+224
-1
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: 'build docker images: MariaDB 10.11 (Ubuntu)'
2+
3+
on:
4+
#push:
5+
# branches:
6+
# - 'main'
7+
# - 'master'
8+
# paths:
9+
# - 'ubuntu.10_11.Dockerfile'
10+
# - 'docker-entrypoint.10_11.sh'
11+
# - 'healthcheck.10_11.sh'
12+
# - '.github/workflows/build_docker_images-ubuntu-10_11.yaml'
13+
workflow_dispatch:
14+
schedule:
15+
- cron: '30 5 16 * *' # At 05:30 on day-of-month 16.
16+
17+
defaults:
18+
run:
19+
shell: bash
20+
21+
jobs:
22+
docker:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v2
27+
28+
- name: Shell-Script
29+
id: script
30+
run: |
31+
BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
32+
BUILD_DATE_NUMERIC="${BUILD_DATE//[^[:digit:]]/}"
33+
COMMIT_HASH=${GITHUB_SHA::8}
34+
GITHUB_REPO=${GITHUB_REPOSITORY,,}
35+
GITHUB_REPO_SHORT=${GITHUB_REPO#*/}
36+
GITHUB_REPO_SHORT=${GITHUB_REPO_SHORT#"docker-"}
37+
#DOCKER_REPO=${{ secrets.DOCKER_USERNAME }}/${GITHUB_REPO_SHORT}
38+
DOCKER_REPO=${{ secrets.DOCKER_USERNAME }}/rpi-mariadb
39+
#REDHAT_QUAY_REPO=${{ secrets.REDHAT_QUAY_USERNAME }}/${GITHUB_REPO_SHORT}
40+
41+
# Set output parameters to github action.
42+
echo ::set-output name=build_date::${BUILD_DATE}
43+
echo ::set-output name=build_date_numeric::${BUILD_DATE_NUMERIC}
44+
echo ::set-output name=commit_hash::${COMMIT_HASH}
45+
echo ::set-output name=github_repo::${GITHUB_REPO}
46+
echo ::set-output name=docker_repo::${DOCKER_REPO}
47+
#echo ::set-output name=redhat_quay_repo::${REDHAT_QUAY_REPO}
48+
49+
- name: Set up QEMU
50+
id: qemu
51+
uses: docker/setup-qemu-action@v2
52+
with:
53+
image: tonistiigi/binfmt:latest
54+
platforms: all
55+
56+
- name: Set up Docker Buildx
57+
id: buildx
58+
uses: docker/setup-buildx-action@v2
59+
60+
#- name: Login to GitHub Container Registry
61+
# uses: docker/login-action@v2
62+
# with:
63+
# registry: ghcr.io
64+
# username: ${{ github.repository_owner }}
65+
# password: ${{ secrets.GITHUB_TOKEN }}
66+
67+
- name: Login to DockerHub
68+
uses: docker/login-action@v2
69+
with:
70+
registry: docker.io
71+
username: ${{ secrets.DOCKER_USERNAME }}
72+
password: ${{ secrets.DOCKER_PASSWORD }}
73+
74+
#- name: Login to RED HAT Quay.io Container Registry
75+
# uses: docker/login-action@v2
76+
# with:
77+
# registry: quay.io
78+
# username: ${{ secrets.REDHAT_QUAY_USERNAME }}
79+
# password: ${{ secrets.REDHAT_QUAY_PASSWORD }}
80+
81+
- name: Build
82+
uses: docker/build-push-action@v3
83+
with:
84+
builder: ${{ steps.buildx.outputs.name }}
85+
context: .
86+
file: ./ubuntu.10_11.Dockerfile
87+
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7
88+
push: true
89+
build-args: |
90+
BUILD_DATE=${{steps.script.outputs.build_date}}
91+
VCS_REF=${{steps.script.outputs.commit_hash}}
92+
tags: |
93+
docker.io/${{steps.script.outputs.docker_repo}}:10.11-ubuntu
94+
docker.io/${{steps.script.outputs.docker_repo}}:10.11-ubuntu-${{steps.script.outputs.build_date_numeric}}.${{steps.script.outputs.commit_hash}}
95+
# ghcr.io/${{steps.script.outputs.github_repo}}:10.11-ubuntu-${{steps.script.outputs.build_date_numeric}}.${{steps.script.outputs.commit_hash}}
96+
# ghcr.io/${{steps.script.outputs.github_repo}}:10.11-ubuntu
97+
# quay.io/${{steps.script.outputs.redhat_quay_repo}}:10.11-ubuntu

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
### Supported tags and respective `Dockerfile` links
44
- [`10.11-alpine` (*Dockerfile*)](https://github.com/Tob1as/docker-mariadb/blob/master/alpine.10_11.Dockerfile) (on AlpineLinux [3.20](https://pkgs.alpinelinux.org/package/v3.20/main/armhf/mariadb))
55
- [`10.11-debian` (*Dockerfile*)](https://github.com/Tob1as/docker-mariadb/blob/master/debian.10_11.Dockerfile) (on Debian [12 (bookworm)](https://packages.debian.org/bookworm/mariadb-server))
6+
- [`10.11-ubuntu` (*Dockerfile*)](https://github.com/Tob1as/docker-mariadb/blob/master/ubuntu.10_11.Dockerfile) (on Ubuntu [24.04 (noble)](https://launchpad.net/ubuntu/noble/+package/mariadb-server))
67

78
**Notes**:
89
* For `amd64` and `arm64` it is recommended to use the [official images](https://hub.docker.com/_/mariadb) based on Ubuntu and not these !
910
* How long MariaDB versions are supported (End of Life): https://mariadb.org/about/#mariadb-server-long-term-release-maintenance-periods
1011
Do not use an container image which MariaDB version is no longer supported!
11-
* How long OS (Alpine, Debian, ...) versions are supported (End of Life): https://alpinelinux.org/releases/ and https://wiki.debian.org/DebianReleases
12+
* How long OS (Alpine, Debian, ...) versions are supported (End of Life): https://alpinelinux.org/releases/ and https://wiki.debian.org/DebianReleases and https://ubuntu.com/about/release-cycle
1213
Do not use an container image which OS version is no longer supported!
1314

1415
# What is MariaDB?

ubuntu.10_11.Dockerfile

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
FROM ubuntu:noble
2+
3+
ARG BUILD_DATE
4+
ARG VCS_REF
5+
6+
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
7+
RUN groupadd -r mysql && useradd -r -g mysql mysql --home-dir /var/lib/mysql
8+
9+
# add gosu for easy step-down from root
10+
# https://github.com/tianon/gosu/releases
11+
# gosu key is B42F6819007F00F88E364FD4036A9C25BF357DD4
12+
ENV GOSU_VERSION=1.19
13+
14+
# install "libjemalloc2" as it offers better performance in some cases. Use with LD_PRELOAD
15+
# install "libtcmalloc-minimal4" as it may improve performance and fix memory fragmentation issues. Use with LD_PRELOAD
16+
# install "pwgen" for randomizing passwords
17+
# install "tzdata" for /usr/share/zoneinfo/
18+
# install "xz-utils" for .sql.xz docker-entrypoint-initdb.d files
19+
# install "zstd" for .sql.zst docker-entrypoint-initdb.d files
20+
# hadolint ignore=SC2086
21+
RUN set -eux; \
22+
apt-get update; \
23+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
24+
ca-certificates \
25+
gpg \
26+
gpgv \
27+
libjemalloc2 \
28+
libtcmalloc-minimal4 \
29+
pwgen \
30+
tzdata \
31+
xz-utils \
32+
zstd ; \
33+
# save list of currently installed packages for later so we can clean up
34+
savedAptMark="$(apt-mark showmanual)"; \
35+
apt-get install -y --no-install-recommends \
36+
dirmngr \
37+
gpg-agent \
38+
wget; \
39+
rm -rf /var/lib/apt/lists/*; \
40+
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
41+
wget -q -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \
42+
wget -q -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \
43+
# verify the signature
44+
GNUPGHOME="$(mktemp -d)"; \
45+
export GNUPGHOME; \
46+
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
47+
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
48+
gpgconf --kill all; \
49+
rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \
50+
# clean up fetch dependencies
51+
apt-mark auto '.*' > /dev/null; \
52+
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark >/dev/null; \
53+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
54+
chmod +x /usr/local/bin/gosu; \
55+
# verify that the binary works
56+
gosu --version; \
57+
gosu nobody true
58+
59+
RUN mkdir /docker-entrypoint-initdb.d
60+
61+
# Ensure the container exec commands handle range of utf8 characters based of
62+
# default locales in base image (https://github.com/docker-library/docs/blob/135b79cc8093ab02e55debb61fdb079ab2dbce87/ubuntu/README.md#locales)
63+
ENV LANG=C.UTF-8
64+
65+
# OCI annotations to image
66+
LABEL org.opencontainers.image.authors="MariaDB Community, Tobias Hargesheimer <docker@ison.ws>" \
67+
org.opencontainers.image.title="MariaDB Database" \
68+
org.opencontainers.image.description="MariaDB Database for relational SQL" \
69+
org.opencontainers.image.licenses="GPL-2.0" \
70+
org.opencontainers.image.created="${BUILD_DATE}" \
71+
org.opencontainers.image.revision="${VCS_REF}" \
72+
org.opencontainers.image.version="10.11" \
73+
org.opencontainers.image.url="https://hub.docker.com/r/tobi312/rpi-mariadb" \
74+
org.opencontainers.image.source="https://github.com/Tob1as/docker-mariadb"
75+
76+
# bashbrew-architectures: *
77+
ENV MARIADB_MAJOR=10.11
78+
ENV MARIADB_VERSION=1:10.11.*
79+
# release-status:Stable
80+
# release-support-type:Long Term Support
81+
# (https://downloads.mariadb.org/rest-api/mariadb/)
82+
83+
# the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql)
84+
# also, we set debconf keys to make APT a little quieter
85+
# hadolint ignore=DL3015
86+
RUN set -ex; \
87+
{ \
88+
echo "mariadb-server" mysql-server/root_password password 'unused'; \
89+
echo "mariadb-server" mysql-server/root_password_again password 'unused'; \
90+
} | debconf-set-selections; \
91+
apt-get update; \
92+
# postinst script creates a datadir, so avoid creating it by faking its existance.
93+
mkdir -p /var/lib/mysql/mysql ; touch /var/lib/mysql/mysql/user.frm ; \
94+
# mariadb-backup is installed at the same time so that `mysql-common` is only installed once from just mariadb repos
95+
apt-get install -y --no-install-recommends mariadb-server="$MARIADB_VERSION" mariadb-backup socat \
96+
; \
97+
rm -rf /var/lib/apt/lists/*; \
98+
# purge and re-create /var/lib/mysql with appropriate ownership
99+
rm -rf /var/lib/mysql /etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf; \
100+
mkdir -p /var/lib/mysql /run/mysqld; \
101+
chown -R mysql:mysql /var/lib/mysql /run/mysqld; \
102+
# ensure that /run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime
103+
chmod 1777 /run/mysqld; \
104+
# comment out a few problematic configuration values
105+
find /etc/mysql/ -name '*.cnf' -print0 \
106+
| xargs -0 grep -lZE '^(bind-address|log|user\s)' \
107+
| xargs -rt -0 sed -Ei 's/^(bind-address|log|user\s)/#&/'; \
108+
# don't reverse lookup hostnames, they are usually another container
109+
printf "[mariadb]\nhost-cache-size=0\nskip-name-resolve\n" > /etc/mysql/mariadb.conf.d/05-skipcache.cnf; \
110+
# Issue #327 Correct order of reading directories /etc/mysql/mariadb.conf.d before /etc/mysql/conf.d (mount-point per documentation)
111+
if [ -L /etc/mysql/my.cnf ]; then \
112+
# 10.5+
113+
sed -i -e '/includedir/ {N;s/\(.*\)\n\(.*\)/\n\2\n\1/}' /etc/mysql/mariadb.cnf; \
114+
fi
115+
116+
117+
VOLUME /var/lib/mysql
118+
119+
COPY healthcheck.10_11.sh /usr/local/bin/healthcheck.sh
120+
COPY docker-entrypoint.10_11.sh /usr/local/bin/docker-entrypoint.sh
121+
RUN chmod +x /usr/local/bin/*.sh
122+
ENTRYPOINT ["docker-entrypoint.sh"]
123+
124+
EXPOSE 3306
125+
CMD ["mariadbd"]

0 commit comments

Comments
 (0)