fix: CRLF/BOM line endings + restart policies + gitattributes
- poller/docker-entrypoint.sh: convert from CRLF+BOM to LF (UTF-8 no BOM) Windows saved the file with a UTF-8 BOM which made the Linux kernel reject the shebang with 'exec format error', crashing the poller. - infrastructure/openbao/init.sh: same CRLF -> LF fix - poller/Dockerfile: add sed to strip CRLF and BOM at image build time as a defensive measure for future Windows edits - docker-compose.override.yml: add 'restart: on-failure' to api and poller so they recover from the postgres startup race (TimescaleDB restarts postgres after initdb, briefly causing connection refused on first boot) - .gitattributes: enforce LF for all text/script/code files so git normalises line endings on checkout and prevents this class of bug
This commit is contained in:
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# Enforce Unix line endings for shell scripts and other Linux-executed files
|
||||
*.sh text eol=lf
|
||||
*.py text eol=lf
|
||||
Dockerfile* text eol=lf
|
||||
*.conf text eol=lf
|
||||
*.sql text eol=lf
|
||||
*.go text eol=lf
|
||||
*.ts text eol=lf
|
||||
*.tsx text eol=lf
|
||||
*.json text eol=lf
|
||||
*.yaml text eol=lf
|
||||
*.yml text eol=lf
|
||||
*.md text eol=lf
|
||||
*.toml text eol=lf
|
||||
*.env* text eol=lf
|
||||
|
||||
# Binary files - no line ending conversion
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
*.ico binary
|
||||
*.woff binary
|
||||
*.woff2 binary
|
||||
*.ttf binary
|
||||
@@ -7,6 +7,7 @@ services:
|
||||
context: .
|
||||
dockerfile: infrastructure/docker/Dockerfile.api
|
||||
container_name: tod_api
|
||||
restart: on-failure
|
||||
ports:
|
||||
- "8001:8000"
|
||||
env_file: .env
|
||||
@@ -66,6 +67,7 @@ services:
|
||||
context: ./poller
|
||||
dockerfile: ./Dockerfile
|
||||
container_name: tod_poller
|
||||
restart: on-failure
|
||||
env_file: .env
|
||||
environment:
|
||||
ENVIRONMENT: dev
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/sh
|
||||
# OpenBao Transit initialization script
|
||||
# Runs after OpenBao starts in dev mode
|
||||
|
||||
|
||||
@@ -13,5 +13,9 @@ FROM alpine:3.21
|
||||
RUN apk add --no-cache ca-certificates iproute2
|
||||
COPY --from=builder /poller /usr/local/bin/poller
|
||||
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
# Strip Windows CRLF line endings and make executable (safe even if already LF)
|
||||
# Strip Windows CRLF and UTF-8 BOM if present (both break Linux shebang parsing)
|
||||
RUN sed -i 's/\r//' /usr/local/bin/docker-entrypoint.sh && \
|
||||
sed -i '1s/^\xef\xbb\xbf//' /usr/local/bin/docker-entrypoint.sh && \
|
||||
chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
|
||||
Reference in New Issue
Block a user