mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-29 15:15:27 -07:00
fix(docker): normalize CRLF line endings on Windows checkouts (#951)
A Windows Git checkout with checkout-time CRLF conversion enabled produces CRLF working-tree copies of package.json and scripts/rocm-entrypoint.sh, breaking the Docker build two ways: - The frontend stage's `sed -i -z 's/,\n ]/…/'` is LF-anchored, so it doesn't match against \r\n and leaves an invalid trailing comma in package.json, which then fails JSON parsing in the vite build. - The final stage copies rocm-entrypoint.sh straight from the build context; with a CRLF shebang the container reports the misleading "no such file or directory" for an entrypoint that plainly exists, because Linux can't resolve "/bin/sh\r" as an interpreter. Add .gitattributes forcing LF for both files at checkout time, plus a sed normalization step in each Dockerfile stage for resilience with clones that predate the .gitattributes rule. Fixes #915
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
package.json text eol=lf
|
||||||
|
scripts/*.sh text eol=lf
|
||||||
+10
-3
@@ -20,8 +20,11 @@ COPY package.json bun.lock CHANGELOG.md ./
|
|||||||
COPY app/ ./app/
|
COPY app/ ./app/
|
||||||
COPY web/ ./web/
|
COPY web/ ./web/
|
||||||
|
|
||||||
# Strip workspaces not needed for web build, and fix trailing comma
|
# Normalize line endings first (a Windows CRLF checkout would otherwise
|
||||||
RUN sed -i '/"tauri"/d; /"landing"/d' package.json && \
|
# defeat the `-z 's/,\n ]/…/'` match below, since it's LF-anchored), then
|
||||||
|
# strip workspaces not needed for web build, and fix trailing comma
|
||||||
|
RUN sed -i 's/\r$//' package.json && \
|
||||||
|
sed -i '/"tauri"/d; /"landing"/d' package.json && \
|
||||||
sed -i -z 's/,\n ]/\n ]/' package.json
|
sed -i -z 's/,\n ]/\n ]/' package.json
|
||||||
RUN bun install --no-save
|
RUN bun install --no-save
|
||||||
# Build frontend (skip tsc — upstream has pre-existing type errors)
|
# Build frontend (skip tsc — upstream has pre-existing type errors)
|
||||||
@@ -100,7 +103,11 @@ EXPOSE 17493
|
|||||||
HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=60s \
|
HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=60s \
|
||||||
CMD curl -f http://localhost:17493/health || exit 1
|
CMD curl -f http://localhost:17493/health || exit 1
|
||||||
|
|
||||||
# Entrypoint joins GPU groups then drops to the voicebox user
|
# Entrypoint joins GPU groups then drops to the voicebox user.
|
||||||
|
# Normalize CRLF (a Windows checkout otherwise leaves the shebang as
|
||||||
|
# `#!/bin/sh\r`, which Linux can't resolve — reported as a misleading
|
||||||
|
# "no such file or directory" even though the file exists).
|
||||||
COPY --chmod=755 scripts/rocm-entrypoint.sh /usr/local/bin/entrypoint.sh
|
COPY --chmod=755 scripts/rocm-entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||||
|
RUN sed -i 's/\r$//' /usr/local/bin/entrypoint.sh
|
||||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||||
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "17493"]
|
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "17493"]
|
||||||
|
|||||||
Reference in New Issue
Block a user