Skip to content

Commit 548ffbc

Browse files
committed
Change permissions for cloned repositories
The current user and group ID are passed passed to the docker build command and the ownership of the cloned directories are changed to them. This gets rid of git's "dubious ownership" error. Without this changes I got an error: > $ make > docker run --rm -v :/var/www/en -w /var/www -u 1000:1000 php/doc-en > configure.php on PHP 8.2.29, libxml 2.9.14 > > fatal: detected dubious ownership in repository at '/var/www/doc-base' > To add an exception for this directory, call: > > git config --global --add safe.directory /var/www/doc-base > doc-base/temp clean up FAILED. > make: *** [Makefile:22: xhtml] Fehler 1 Resolves: php/doc-en#4645
1 parent 5586169 commit 548ffbc

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎.docker/Dockerfile‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
FROM php:8.2-cli
2+
ARG UID=1000
3+
ARG GID=1000
24

35
RUN apt-get update && \
46
apt-get install -y git default-jre-headless
@@ -9,7 +11,8 @@ ADD https://api.github.com/repos/php/phd/git/refs/heads/master version-phd.json
911
ADD https://api.github.com/repos/php/doc-base/git/refs/heads/master version-doc-base.json
1012

1113
RUN git clone --depth 1 https://github.com/php/phd.git && \
12-
git clone --depth 1 https://github.com/php/doc-base.git
14+
git clone --depth 1 https://github.com/php/doc-base.git && \
15+
chown -R $UID:$GID phd doc-base
1316

1417
RUN echo 'memory_limit = 512M' >> /usr/local/etc/php/conf.d/local.ini
1518

‎Makefile‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,7 @@ php: .docker/built
2828
build: .docker/built
2929

3030
.docker/built:
31-
docker build .docker -t php/doc-en
31+
docker build\
32+
--build-arg UID=${CURRENT_UID} --build-arg GID=${CURRENT_GID}\
33+
.docker -t php/doc-en
3234
touch .docker/built

0 commit comments

Comments
 (0)