From 4f6d2039cdfee4a857c26e44a40ee7f1edb8306c Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Sun, 24 Oct 2021 20:12:53 +0100 Subject: [PATCH 1/4] chmod executables when copying to the docker Run chmod on the executables and the entrypoint when copying them to the docker in dockerfile. Signed-off-by: Andrew Thornton --- Dockerfile | 3 +++ Dockerfile.rootless | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 382f6f330ace6..9c4d3f75f37a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -66,4 +66,7 @@ CMD ["/bin/s6-svscan", "/etc/s6"] COPY docker/root / COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea COPY --from=build-env /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini +RUN chmod 755 /usr/bin/entrypoint +RUN chmod 755 /app/gitea/gitea +RUN chmod 755 /usr/local/bin/environment-to-ini RUN ln -s /app/gitea/gitea /usr/local/bin/gitea diff --git a/Dockerfile.rootless b/Dockerfile.rootless index 64dd12bb6bf54..cd5188d3c08a6 100644 --- a/Dockerfile.rootless +++ b/Dockerfile.rootless @@ -9,7 +9,7 @@ ENV GOPROXY ${GOPROXY:-direct} ARG GITEA_VERSION ARG TAGS="sqlite sqlite_unlock_notify" ENV TAGS "bindata timetzdata $TAGS" -ARG CGO_EXTRA_CFLAGS +ARG CGO_EXTRA_CFLAGS #Build deps RUN apk --no-cache add build-base git nodejs npm @@ -55,6 +55,9 @@ RUN chown git:git /var/lib/gitea /etc/gitea COPY docker/rootless / COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/gitea /usr/local/bin/gitea COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini +RUN chmod 755 /usr/local/bin/docker-entrypoint.sh +RUN chmod 755 /app/gitea/gitea +RUN chmod 755 /usr/local/bin/environment-to-ini #git:git USER 1000:1000 From 883048021ef8d3ae879804ecdd7b132c1a67c45d Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 25 Oct 2021 09:41:28 +0200 Subject: [PATCH 2/4] Update Dockerfile Co-authored-by: Norwin --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9c4d3f75f37a0..fa50039a556da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -66,7 +66,5 @@ CMD ["/bin/s6-svscan", "/etc/s6"] COPY docker/root / COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea COPY --from=build-env /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini -RUN chmod 755 /usr/bin/entrypoint -RUN chmod 755 /app/gitea/gitea -RUN chmod 755 /usr/local/bin/environment-to-ini +RUN chmod 755 /usr/bin/entrypoint /app/gitea/gitea /usr/local/bin/environment-to-ini RUN ln -s /app/gitea/gitea /usr/local/bin/gitea From 349709d0f2212812602f8e514d09aaa98755fb37 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 25 Oct 2021 09:41:44 +0200 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: delvh --- Dockerfile.rootless | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile.rootless b/Dockerfile.rootless index cd5188d3c08a6..999684e9f0ff3 100644 --- a/Dockerfile.rootless +++ b/Dockerfile.rootless @@ -55,9 +55,7 @@ RUN chown git:git /var/lib/gitea /etc/gitea COPY docker/rootless / COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/gitea /usr/local/bin/gitea COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini -RUN chmod 755 /usr/local/bin/docker-entrypoint.sh -RUN chmod 755 /app/gitea/gitea -RUN chmod 755 /usr/local/bin/environment-to-ini +RUN chmod 755 /usr/local/bin/docker-entrypoint.sh /app/gitea/gitea /usr/local/bin/environment-to-ini #git:git USER 1000:1000 From e603b8347f41104c3e56291f5236c0c975214b17 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Mon, 25 Oct 2021 17:14:01 +0100 Subject: [PATCH 4/4] as per review Signed-off-by: Andrew Thornton --- Dockerfile | 1 + Dockerfile.rootless | 1 + 2 files changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 9c4d3f75f37a0..083af1042600d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -69,4 +69,5 @@ COPY --from=build-env /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/ RUN chmod 755 /usr/bin/entrypoint RUN chmod 755 /app/gitea/gitea RUN chmod 755 /usr/local/bin/environment-to-ini +RUN chmod 755 /etc/s6/gitea/* /etc/s6/openssh/* /etc/s6/.s6-svscan/* RUN ln -s /app/gitea/gitea /usr/local/bin/gitea diff --git a/Dockerfile.rootless b/Dockerfile.rootless index cd5188d3c08a6..4a8d3be5922e0 100644 --- a/Dockerfile.rootless +++ b/Dockerfile.rootless @@ -56,6 +56,7 @@ COPY docker/rootless / COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/gitea /usr/local/bin/gitea COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini RUN chmod 755 /usr/local/bin/docker-entrypoint.sh +RUN chmod 755 /usr/local/bin/docker-setup.sh RUN chmod 755 /app/gitea/gitea RUN chmod 755 /usr/local/bin/environment-to-ini