From 42f9785624b1b9062d430d1c7e143f2d0c03ef4b Mon Sep 17 00:00:00 2001 From: Brian Fertig Date: Wed, 12 Aug 2026 13:27:23 -0600 Subject: [PATCH] fix: ensure LF line endings for docker-entrypoint.sh on Windows checkouts Add .gitattributes to enforce LF line endings for shell scripts and Dockerfile. Update Dockerfile to strip CRLF before making docker-entrypoint.sh executable, preventing "no such file or directory" errors at container startup caused by CRLF shebang lines on Windows. --- .gitattributes | 7 +++++++ Dockerfile | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..c9e02df --- /dev/null +++ b/.gitattributes @@ -0,0 +1,7 @@ +# Force LF for anything that gets exec'd inside the (Linux) Docker image. +# Checking these out with CRLF -- which happens by default on Windows +# clones with core.autocrlf=true -- breaks `exec` at container startup +# with a misleading "no such file or directory": the CRLF shebang line +# doesn't resolve to a real interpreter path. +*.sh text eol=lf +Dockerfile text eol=lf diff --git a/Dockerfile b/Dockerfile index b6cc6b7..7af2223 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,12 @@ COPY --from=build /app/prisma.config.ts ./prisma.config.ts COPY --from=build /app/package.json ./package.json COPY --from=build /app/next.config.ts ./next.config.ts COPY docker-entrypoint.sh ./docker-entrypoint.sh -RUN chmod +x docker-entrypoint.sh +# Strip any CRLF line endings before making it executable -- a CRLF +# shebang (e.g. from a Windows checkout without .gitattributes honoring +# `eol=lf`) makes the kernel look for a literal "/bin/sh\r" interpreter, +# which fails with a misleading "no such file or directory" at container +# startup. This keeps the image correct even if the checkout wasn't. +RUN sed -i 's/\r$//' docker-entrypoint.sh && chmod +x docker-entrypoint.sh EXPOSE 3000 ENTRYPOINT ["./docker-entrypoint.sh"]