feat(docker): add safe.directory git config for git-enabled containers

Prevents "dubious ownership" errors when running git commands in containers
with mounted repositories (root user + external volume).
This commit is contained in:
ZhenYi 2026-05-13 00:32:41 +08:00
parent 1c55cb8559
commit 96ce6fde1c
3 changed files with 3 additions and 0 deletions

View File

@ -2,6 +2,7 @@ FROM ubuntu:24.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates libssl3 openssh-client procps git \
&& rm -rf /var/lib/apt/lists/*
RUN git config --system --add safe.directory '*'
WORKDIR /app
COPY ./target/release/app /bin
EXPOSE 3000

View File

@ -2,6 +2,7 @@ FROM ubuntu:24.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates libssl3 git \
&& rm -rf /var/lib/apt/lists/*
RUN git config --system --add safe.directory '*'
WORKDIR /app
COPY ./target/release/git-hook /bin
EXPOSE 8083

View File

@ -2,6 +2,7 @@ FROM ubuntu:24.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates libssl3 git openssh-client \
&& rm -rf /var/lib/apt/lists/*
RUN git config --system --add safe.directory '*'
WORKDIR /app
COPY ./target/release/gitserver /bin
EXPOSE 8021 2222