docker: revert back linuxbrew's UID to 1000

In https://github.com/Homebrew/brew/pull/17584 we have changed "linuxbrew" user's UID/GID to 1001 in order to mitigate for Ubuntu 23.04 and higher, which started creating a default "ubuntu" user taking over UID/GID 1000 .

While we may desire a deterministic UID in the homebrew docker image, the change effectively modified the behaviour for all current 3 images based on Ubuntu 18.04 20.04 and 22.04 by changing the linuxbrew's user UID/GID from 1000 to 1001. As per https://hub.docker.com/u/homebrew, we do not currently publish an image for 24.04 which the change is mitigating for.

Rather than mitigating for indeterministic behaviour of upstream changes, this commit implements the workaround in https://bugs.launchpad.net/cloud-images/+bug/2005129 to delete the default "ubuntu" user.
This commit is contained in:
Andrei Neculau 2024-07-09 21:29:49 +02:00
parent b098b4c3a0
commit bc8c7a2a16
No known key found for this signature in database
GPG Key ID: 54AE1ED149E20070

View File

@ -4,9 +4,11 @@ ARG version=22.04
FROM ubuntu:"${version}" FROM ubuntu:"${version}"
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
# Set the user ID to the default value of 1001 since different ubuntu # Deterministic UID (first user). Helps with docker build cache
# versions yield to different user IDs with `useradd` ENV USER_ID=1000
ENV USER_ID=1001 # Delete the default ubuntu user & group UID=1000 GID=1000 in Ubuntu 23.04+
# that conflicts with the linuxbrew user
RUN touch /var/mail/ubuntu && chown ubuntu /var/mail/ubuntu && userdel -r ubuntu; true
# We don't want to manually pin versions, happy to use whatever # We don't want to manually pin versions, happy to use whatever
# Ubuntu thinks is best. # Ubuntu thinks is best.