ci: use the runner's uid/gid Use the runner's uid/gid for the containers for sanity when sharing files across volumes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index d9ca82c..774381f 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -69,7 +69,7 @@ jobs:
if [ "${{ matrix.container.base }}" != "" ]; then
BASE_ARG="--build-arg BASE=${{ matrix.container.base }}"
fi
- docker build -t ${{ env.docker-registry-container-sha }} ${BASE_ARG} -f ${{ env.dockerfile }} .
+ docker build -t ${{ env.docker-registry-container-sha }} --build-arg UID=$(id -u) --build-arg GID=$(id -g) ${BASE_ARG} -f ${{ env.dockerfile }} .
docker tag ${{ env.docker-registry-container-sha }} ${{ env.docker-registry-container-latest }}
docker push ${{ env.docker-registry-container-sha }}
docker push ${{ env.docker-registry-container-latest }}
diff --git a/ci/docker/bionic b/ci/docker/bionic
index 51af5c0..52832f3 100644
--- a/ci/docker/bionic
+++ b/ci/docker/bionic
@@ -38,7 +38,12 @@ RUN cd /tmp && \
rm -rf mbedtls-2.16.2
FROM mbedtls AS adduser
-RUN useradd --shell /bin/bash libgit2 --create-home
+ARG UID=""
+ARG GID=""
+RUN if [ "${UID}" != "" ]; then USER_ARG="--uid ${UID}"; fi && \
+ if [ "${GID}" != "" ]; then GROUP_ARG="--gid ${GID}"; fi && \
+ groupadd ${GROUP_ARG} libgit2 && \
+ useradd ${USER_ARG} --gid libgit2 --shell /bin/bash --create-home libgit2
FROM adduser AS configure
RUN mkdir /var/run/sshd
diff --git a/ci/docker/centos7 b/ci/docker/centos7
index 8105f14..28ed650 100644
--- a/ci/docker/centos7
+++ b/ci/docker/centos7
@@ -48,7 +48,12 @@ RUN cd /tmp && \
rm -rf cmake-3.21.1
FROM cmake AS adduser
-RUN useradd --shell /bin/bash libgit2 --create-home
+ARG UID=""
+ARG GID=""
+RUN if [ "${UID}" != "" ]; then USER_ARG="--uid ${UID}"; fi && \
+ if [ "${GID}" != "" ]; then GROUP_ARG="--gid ${GID}"; fi && \
+ groupadd ${GROUP_ARG} libgit2 && \
+ useradd ${USER_ARG} --gid libgit2 --shell /bin/bash --create-home libgit2
FROM adduser AS configure
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig
diff --git a/ci/docker/centos8 b/ci/docker/centos8
index cca0881..823a465 100644
--- a/ci/docker/centos8
+++ b/ci/docker/centos8
@@ -40,7 +40,12 @@ RUN cd /tmp && \
rm -rf valgrind-3.15.0
FROM valgrind AS adduser
-RUN useradd --shell /bin/bash libgit2 --create-home
+ARG UID=""
+ARG GID=""
+RUN if [ "${UID}" != "" ]; then USER_ARG="--uid ${UID}"; fi && \
+ if [ "${GID}" != "" ]; then GROUP_ARG="--gid ${GID}"; fi && \
+ groupadd ${GROUP_ARG} libgit2 && \
+ useradd ${USER_ARG} --gid libgit2 --shell /bin/bash --create-home libgit2
FROM adduser AS configure
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig
diff --git a/ci/docker/focal b/ci/docker/focal
index 37d7d63..8061237 100644
--- a/ci/docker/focal
+++ b/ci/docker/focal
@@ -73,7 +73,13 @@ RUN cd /tmp && \
rm -rf valgrind-3.15.0
FROM valgrind AS adduser
-RUN useradd --shell /bin/bash libgit2 --create-home
+ARG UID=""
+ARG GID=""
+RUN if [ "${UID}" != "" ]; then USER_ARG="--uid ${UID}"; fi && \
+ if [ "${GID}" != "" ]; then GROUP_ARG="--gid ${GID}"; fi && \
+ groupadd ${GROUP_ARG} libgit2 && \
+ useradd ${USER_ARG} --gid libgit2 --shell /bin/bash --create-home libgit2
+
FROM adduser AS configure
RUN mkdir /var/run/sshd
diff --git a/ci/docker/xenial b/ci/docker/xenial
index c19fe42..c979146 100644
--- a/ci/docker/xenial
+++ b/ci/docker/xenial
@@ -60,7 +60,13 @@ RUN cd /tmp && \
rm -rf valgrind-3.15.0
FROM valgrind AS adduser
-RUN useradd --shell /bin/bash libgit2 --create-home
+ARG UID=""
+ARG GID=""
+RUN if [ "${UID}" != "" ]; then USER_ARG="--uid ${UID}"; fi && \
+ if [ "${GID}" != "" ]; then GROUP_ARG="--gid ${GID}"; fi && \
+ groupadd ${GROUP_ARG} libgit2 && \
+ useradd ${USER_ARG} --gid libgit2 --shell /bin/bash --create-home libgit2
+
FROM adduser AS configure
RUN mkdir /var/run/sshd