Skip to content

fix: use entrypoint.sh in Dockerfile for startup validation#35

Merged
gordonmurray merged 1 commit into
lance-format:mainfrom
gordonmurray:fix/use-entrypoint-script
Apr 6, 2026
Merged

fix: use entrypoint.sh in Dockerfile for startup validation#35
gordonmurray merged 1 commit into
lance-format:mainfrom
gordonmurray:fix/use-entrypoint-script

Conversation

@gordonmurray
Copy link
Copy Markdown
Collaborator

Summary

  • docker/entrypoint.sh validates that DATA_PATH exists and is readable before starting uvicorn, but the Dockerfile bypassed it with a direct CMD
  • When DATA_PATH was missing or unreadable, users got a Python traceback instead of a clear error message
  • The entrypoint script already uses exec so uvicorn replaces the shell process and receives signals (SIGTERM etc.) correctly on container shutdown

Changes

One file changed: docker/Dockerfile

  • COPY docker/entrypoint.sh into the image
  • chmod +x the script
  • Replace CMD ["python", "-m", "uvicorn", ...] with ENTRYPOINT ["/app/entrypoint.sh"]

Test

# Missing DATA_PATH
$ docker run --rm -e DATA_PATH=/nonexistent lance-data-viewer:test
ERROR: Data path /nonexistent does not exist or is not mounted

# Unreadable DATA_PATH
$ docker run --rm -v /tmp/unreadable:/data:ro lance-data-viewer:test
ERROR: Data path /data is not readable

# Happy path
$ docker run --rm -p 8080:8080 -v ./data:/data:ro lance-data-viewer:test
Starting Lance Viewer on port 8080...
Data path: /data
INFO:     Started server process

Fixes #21

The entrypoint script (docker/entrypoint.sh) validates that DATA_PATH
exists and is readable before starting uvicorn, but the Dockerfile
bypassed it with a direct CMD to uvicorn. When DATA_PATH was missing
or unreadable, users got a Python traceback instead of a clear error.

Changes:
- COPY entrypoint.sh into the image and chmod +x
- Replace CMD with ENTRYPOINT pointing to the script
- The script uses exec so uvicorn replaces the shell process and
  receives signals (SIGTERM etc.) correctly on container shutdown

Tested:
- Missing DATA_PATH: clear "does not exist or is not mounted" error
- Unreadable DATA_PATH: clear "is not readable" error
- Valid DATA_PATH: uvicorn starts, /healthz returns 200

Fixes lance-format#21
@gordonmurray gordonmurray merged commit 61888e5 into lance-format:main Apr 6, 2026
12 checks passed
@gordonmurray gordonmurray deleted the fix/use-entrypoint-script branch April 6, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: use entrypoint.sh in Dockerfile for startup validation

1 participant