diff --git a/.dockerignore b/.dockerignore index 16a13794bf..944b62eb98 100644 --- a/.dockerignore +++ b/.dockerignore @@ -76,6 +76,7 @@ cpu.out /.go-licenses Dockerfile Dockerfile.rootless + # Files and folders that were previously generated /public/assets/img/webpack diff --git a/Dockerfile b/Dockerfile index 31959d42c2..774084ba82 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,6 +26,16 @@ RUN --mount=type=cache,target=/go/pkg/mod \ --mount=type=bind,source=".git/",target=".git/" \ make +COPY docker/root /tmp/local + +# Set permissions for builds that made under windows which strips the executable bit from file +RUN chmod 755 /tmp/local/usr/bin/entrypoint \ + /tmp/local/usr/local/bin/* \ + /tmp/local/etc/s6/gitea/* \ + /tmp/local/etc/s6/openssh/* \ + /tmp/local/etc/s6/.s6-svscan/* \ + /go/src/code.gitea.io/gitea/gitea + FROM docker.io/library/alpine:3.22 AS gitea EXPOSE 22 3000 @@ -55,7 +65,7 @@ RUN addgroup \ git && \ echo "git:*" | chpasswd -e -COPY docker/root / +COPY --from=build-env /tmp/local / COPY --chmod=755 --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea ENV USER=git diff --git a/Dockerfile.rootless b/Dockerfile.rootless index ec9a91d611..d709d99b59 100644 --- a/Dockerfile.rootless +++ b/Dockerfile.rootless @@ -26,6 +26,12 @@ RUN --mount=type=cache,target=/go/pkg/mod \ --mount=type=bind,source=".git/",target=".git/" \ make +COPY docker/rootless /tmp/local + +# Set permissions for builds that made under windows which strips the executable bit from file +RUN chmod 755 /tmp/local/usr/local/bin/* \ + /go/src/code.gitea.io/gitea/gitea + FROM docker.io/library/alpine:3.22 AS gitea-rootless EXPOSE 2222 3000 @@ -54,7 +60,7 @@ RUN addgroup \ RUN mkdir -p /var/lib/gitea /etc/gitea RUN chown git:git /var/lib/gitea /etc/gitea -COPY docker/rootless / +COPY --from=build-env /tmp/local / COPY --from=build-env --chmod=755 --chown=root:root /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea # git:git