From 2a5d82181ea18ad5db13281b1a7d87a270a446b7 Mon Sep 17 00:00:00 2001 From: YOMXXX Date: Sun, 24 May 2026 00:01:10 +0800 Subject: [PATCH] fix(docker): normalize core entrypoint line endings (#2545) --- .dockerignore | 4 +++- .gitattributes | 6 ++++++ .github/workflows/deploy-smoke.yml | 4 ++++ Dockerfile | 6 +++++- 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 .gitattributes diff --git a/.dockerignore b/.dockerignore index 37e46e1bb..d3244a91b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -38,5 +38,7 @@ Thumbs.db tests/ scripts/ # Re-include the Docker entrypoint for the core image (Dockerfile COPYs it). -# The negation must come after the broad exclusion above to take effect. +# Re-include the parent directory first so older Docker pattern matchers that +# prune excluded directories still see the leaf exception below. +!scripts/ !scripts/docker-entrypoint-core.sh diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..91a95bdc2 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +*.sh text eol=lf +*.bash text eol=lf +Dockerfile text eol=lf +.dockerignore text eol=lf +docker-compose*.yml text eol=lf +*.ps1 text eol=crlf diff --git a/.github/workflows/deploy-smoke.yml b/.github/workflows/deploy-smoke.yml index a1cf557b2..87a39eb8c 100644 --- a/.github/workflows/deploy-smoke.yml +++ b/.github/workflows/deploy-smoke.yml @@ -6,7 +6,9 @@ on: paths: - Dockerfile - .dockerignore + - .gitattributes - docker-compose.yml + - scripts/docker-entrypoint-core.sh - .do/app.yaml - gitbooks/developing/cloud-deploy.md - .github/workflows/deploy-smoke.yml @@ -18,7 +20,9 @@ on: paths: - Dockerfile - .dockerignore + - .gitattributes - docker-compose.yml + - scripts/docker-entrypoint-core.sh - .do/app.yaml - gitbooks/developing/cloud-deploy.md - .github/workflows/deploy-smoke.yml diff --git a/Dockerfile b/Dockerfile index 209d696c1..84f630f74 100644 --- a/Dockerfile +++ b/Dockerfile @@ -97,7 +97,11 @@ COPY --from=builder /tmp/openhuman-core /usr/local/bin/openhuman-core # privileges. The script is a separate file so the E2E entrypoint # (e2e/docker-entrypoint.sh) is not affected. COPY scripts/docker-entrypoint-core.sh /usr/local/bin/docker-entrypoint-core.sh -RUN chmod +x /usr/local/bin/docker-entrypoint-core.sh +# Windows checkouts may materialize shell scripts with CRLF line endings when +# core.autocrlf is enabled. A CRLF shebang makes Linux report the executable +# as "no such file or directory" at container startup, so normalize in-image. +RUN sed -i 's/\r$//' /usr/local/bin/docker-entrypoint-core.sh \ + && chmod +x /usr/local/bin/docker-entrypoint-core.sh # The entrypoint runs as root so it can chown the mounted volume, then execs # gosu to drop to the openhuman user before starting the binary.