Skip to content

Commit

Permalink
purge of noble ubuntu user
Browse files Browse the repository at this point in the history
Some users depend on a groupid of 1000 as empty.

Its not really used by us so lets remove the entire
ubuntu user and the ubuntu group that came with it.

e.g; FREVA-CLINT/freva#204
  • Loading branch information
grooverdan committed Jun 20, 2024
1 parent aecdf2e commit fb46c56
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion 11.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM ubuntu:noble

# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mysql && useradd -r -g mysql mysql --home-dir /var/lib/mysql
RUN groupadd -r mysql && useradd -r -g mysql mysql --home-dir /var/lib/mysql && userdel --remove ubuntu

# add gosu for easy step-down from root
# https://github.com/tianon/gosu/releases
Expand Down
2 changes: 1 addition & 1 deletion 11.5/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM ubuntu:noble

# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mysql && useradd -r -g mysql mysql --home-dir /var/lib/mysql
RUN groupadd -r mysql && useradd -r -g mysql mysql --home-dir /var/lib/mysql && userdel --remove ubuntu

# add gosu for easy step-down from root
# https://github.com/tianon/gosu/releases
Expand Down
2 changes: 1 addition & 1 deletion 11.6/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM ubuntu:noble

# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mysql && useradd -r -g mysql mysql --home-dir /var/lib/mysql
RUN groupadd -r mysql && useradd -r -g mysql mysql --home-dir /var/lib/mysql && userdel --remove ubuntu

# add gosu for easy step-down from root
# https://github.com/tianon/gosu/releases
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM ubuntu:%%SUITE%%

# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mysql && useradd -r -g mysql mysql --home-dir /var/lib/mysql
RUN groupadd -r mysql && useradd -r -g mysql mysql --home-dir /var/lib/mysql && userdel --remove ubuntu

# add gosu for easy step-down from root
# https://github.com/tianon/gosu/releases
Expand Down
9 changes: 8 additions & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ update_version()
-e '/memory\.pressure/,+7d' "$dir/docker-entrypoint.sh"
sed -i -e '/--skip-ssl/d' \
-e '0,/#ENDOFSUBSTITUTIONS/s/\tmariadb/\tmysql/' "$dir/healthcheck.sh"
sed -i -e '/^CMD/s/mariadbd/mysqld/' "$dir/Dockerfile"
sed -i -e '/^CMD/s/mariadbd/mysqld/' \
-e 's/ && userdel.*//' \
"$dir/Dockerfile"
sed -i -e 's/mariadb_upgrade_info/mysql_upgrade_info/' \
"$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
;;
Expand All @@ -116,6 +118,8 @@ update_version()
sed -i -e '/--skip-ssl/d' "$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
sed -i -e 's/mariadb_upgrade_info/mysql_upgrade_info/' \
"$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
sed -i -e 's/ && userdel.*//' \
"$dir/Dockerfile"
;;
10.11)
sed -i -e 's/mariadb_upgrade_info/mysql_upgrade_info/' \
Expand All @@ -126,6 +130,7 @@ update_version()
sed -i -e '/^ARG MARIADB_MAJOR/d' \
-e '/^ENV MARIADB_MAJOR/d' \
-e 's/-\$MARIADB_MAJOR//' \
-e 's/ && userdel.*//' \
"$dir/Dockerfile"
;;
*)
Expand All @@ -138,6 +143,8 @@ update_version()
if [[ $vmin =~ 11.[12] ]]; then
sed -i -e '/--skip-ssl/d' \
"$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
sed -i -e 's/ && userdel.*//' \
"$dir/Dockerfile"
fi
if [ "$vmin" == 11.1 ]; then
sed -i -e 's/50-mysqld_safe.cnf/50-mariadb_safe.cnf/' "$dir/Dockerfile"
Expand Down

0 comments on commit fb46c56

Please sign in to comment.