From 8cae9d6cfdeda04bbbd6f93c5fc2098b3cc1499f Mon Sep 17 00:00:00 2001 From: "vitess-bot[bot]" <108069721+vitess-bot[bot]@users.noreply.github.com> Date: Tue, 7 Mar 2023 15:27:51 +0200 Subject: [PATCH] [release-16.0] Fix dubious ownership of git directory in `vitess/base` Docker build (#12530) (#12561) * Fix dubious ownership of git directory in vitess/base Docker build Signed-off-by: Florent Poinsard * Use consistent method to copy and build vitess between base and lite Signed-off-by: Florent Poinsard * fix all base Dockerfiles Signed-off-by: Florent Poinsard --------- Signed-off-by: Florent Poinsard Co-authored-by: Florent Poinsard --- docker/base/Dockerfile | 9 +++------ docker/base/Dockerfile.mysql57 | 9 +++------ docker/base/Dockerfile.percona57 | 9 +++------ docker/base/Dockerfile.percona80 | 5 +---- 4 files changed, 10 insertions(+), 22 deletions(-) diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index b583c838d7d..ee520efa00a 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -30,12 +30,9 @@ ARG BUILD_GIT_BRANCH ARG BUILD_GIT_REV # Re-copy sources from working tree -USER root -COPY . /vt/src/vitess.io/vitess +COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess + +USER vitess # Build Vitess RUN make build - -# Fix permissions -RUN chown -R vitess:vitess /vt -USER vitess diff --git a/docker/base/Dockerfile.mysql57 b/docker/base/Dockerfile.mysql57 index a55d9776ccc..d05fa944951 100644 --- a/docker/base/Dockerfile.mysql57 +++ b/docker/base/Dockerfile.mysql57 @@ -30,12 +30,9 @@ ARG BUILD_GIT_BRANCH ARG BUILD_GIT_REV # Re-copy sources from working tree -USER root -COPY . /vt/src/vitess.io/vitess +COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess + +USER vitess # Build Vitess RUN make build - -# Fix permissions -RUN chown -R vitess:vitess /vt -USER vitess diff --git a/docker/base/Dockerfile.percona57 b/docker/base/Dockerfile.percona57 index 715f6f7927e..8dcc5a909e3 100644 --- a/docker/base/Dockerfile.percona57 +++ b/docker/base/Dockerfile.percona57 @@ -30,12 +30,9 @@ ARG BUILD_GIT_BRANCH ARG BUILD_GIT_REV # Re-copy sources from working tree -USER root -COPY . /vt/src/vitess.io/vitess +COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess + +USER vitess # Build Vitess RUN make build - -# Fix permissions -RUN chown -R vitess:vitess /vt -USER vitess diff --git a/docker/base/Dockerfile.percona80 b/docker/base/Dockerfile.percona80 index e9c31f3717d..40918d35378 100644 --- a/docker/base/Dockerfile.percona80 +++ b/docker/base/Dockerfile.percona80 @@ -30,11 +30,8 @@ ARG BUILD_GIT_BRANCH ARG BUILD_GIT_REV # Re-copy sources from working tree -USER root -COPY . /vt/src/vitess.io/vitess +COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess -# Fix permissions -RUN chown -R vitess:vitess /vt USER vitess # Build Vitess