[ci/deb] Allow using an existing UID/GID for the CI user

This commit is contained in:
Ariel Abreu 2023-11-01 21:28:48 -04:00
parent 8e3da42792
commit 141c24aaa8

View File

@ -5,14 +5,10 @@ ARG BASE_IMAGE=ubuntu:jammy
FROM $BASE_IMAGE FROM $BASE_IMAGE
LABEL name=darling-build-image version=0.1.0 LABEL name=darling-build-image version=0.1.0
ARG DEBIAN_FRONTEND="noninteractive" ARG DEBIAN_FRONTEND="noninteractive"
ARG CI_UID=1111
ARG CI_GID=1111
RUN cp /etc/apt/sources.list /etc/apt/sources.list.d/sources-src.list && sed -i 's|deb http|deb-src http|g' /etc/apt/sources.list.d/sources-src.list RUN cp /etc/apt/sources.list /etc/apt/sources.list.d/sources-src.list && sed -i 's|deb http|deb-src http|g' /etc/apt/sources.list.d/sources-src.list
RUN apt-get -y update RUN apt-get -y update
RUN apt-get -y install cmake clang bison flex libfuse-dev libudev-dev pkg-config libc6-dev-i386 gcc-multilib libcairo2-dev libgl1-mesa-dev libglu1-mesa-dev libtiff5-dev libfreetype6-dev git git-lfs libelf-dev libxml2-dev libegl1-mesa-dev libfontconfig1-dev libbsd-dev libxrandr-dev libxcursor-dev libgif-dev libavutil-dev libpulse-dev libavformat-dev libavcodec-dev libswresample-dev libdbus-1-dev libxkbfile-dev libssl-dev llvm-dev libvulkan-dev && apt clean -y RUN apt-get -y install cmake clang bison flex libfuse-dev libudev-dev pkg-config libc6-dev-i386 gcc-multilib libcairo2-dev libgl1-mesa-dev libglu1-mesa-dev libtiff5-dev libfreetype6-dev git git-lfs libelf-dev libxml2-dev libegl1-mesa-dev libfontconfig1-dev libbsd-dev libxrandr-dev libxcursor-dev libgif-dev libavutil-dev libpulse-dev libavformat-dev libavcodec-dev libswresample-dev libdbus-1-dev libxkbfile-dev libssl-dev llvm-dev libvulkan-dev && apt clean -y
RUN apt-get -y install lsb-release && apt clean -y RUN apt-get -y install lsb-release && apt clean -y
RUN groupadd -g "${CI_GID}" ci
RUN useradd -u "${CI_UID}" -g "${CI_GID}" -m ci
RUN apt-get -y install devscripts equivs debhelper && apt clean -y RUN apt-get -y install devscripts equivs debhelper && apt clean -y
COPY control /control COPY control /control
RUN mk-build-deps -i -r -t "apt-get --no-install-recommends -y" /control && apt clean -y RUN mk-build-deps -i -r -t "apt-get --no-install-recommends -y" /control && apt clean -y
@ -35,7 +31,11 @@ RUN if [ "$(cmake --version | head -n 1 | cut -d ' ' -f 3 | awk '{print $1"\n3.2
RUN apt-get install -y --only-upgrade clang cmake && apt clean -y RUN apt-get install -y --only-upgrade clang cmake && apt clean -y
ARG CI_UID=1111
ARG CI_GID=1111
RUN groupadd -g "${CI_GID}" ci || true
RUN useradd -u "${CI_UID}" -g "${CI_GID}" -m ci || true
RUN mkdir -p /ccache RUN mkdir -p /ccache
RUN mkdir -p /src/mnt RUN mkdir -p /src/mnt
RUN chown -R ci:ci /src RUN chown -R ${CI_UID}:${CI_GID} /src
USER ci USER ${CI_UID}:${CI_GID}