Improve Dockerfile and entrypoint for production use#15
Improve Dockerfile and entrypoint for production use#15sonirahul wants to merge 1 commit intolitespeedtech:masterfrom
Conversation
- Add apt cache cleanup (rm -rf /var/lib/apt/lists/*) to reduce image size - Add HEALTHCHECK instruction for container health monitoring - Add SIGTERM/SIGINT trap in entrypoint for graceful shutdown - Add custom setup.sh hook support via volume mount - Consolidate post-setup RUN layers (setup, chown, config backup) - Add descriptive comments throughout Dockerfile - Fail build explicitly on unsupported platforms (exit 1) - Add -y flag consistently to all apt-get install commands Tested with OLS 1.8.5 + lsphp85 on linux/arm64: - HTTP 200, HTTPS 200 - HEALTHCHECK reports healthy - Graceful shutdown via docker stop completes without timeout
50abbe5 to
2e3f49e
Compare
|
Thanks. Before merging, could you help explain what this command is for? |
|
The What it does:
Flags breakdown:
Why it matters: This is especially useful in orchestration (Docker Swarm, Compose with |
|
Thanks. The other changes look good, but I think the HEALTHCHECK could be an issue, for example, localhost might be unavailable, return a non-200 status code, or the default site might redirect. Can you modify that part? |
Summary
This PR improves the Dockerfile and entrypoint script with production-hardening changes while maintaining full backward compatibility.
Changes
Dockerfile
rm -rf /var/lib/apt/lists/*after all package installations are completeHEALTHCHECKinstruction (curl -sf http://localhost/) with 30s interval, 5s timeout, 10s start periodechotoecho && exit 1setup_docker.sh,chown,cp conf,cp admin/confinto a singleRUNlayer-yflag-yto allapt-get installcommandsEntrypoint (
entrypoint.sh)trap shutdown SIGTERM SIGINThandler that callslswsctrl stopdocker stopgracefully instead of being killed after timeoutTesting
Tested with OLS 1.8.5 + lsphp85 on
linux/arm64(Apple Silicon via Docker Desktop):HEALTHCHECKreportshealthyafter start perioddocker stopcompletes gracefully (no SIGKILL timeout)Backward Compatibility
All changes are additive. Existing
docker-compose.ymlfiles, volume mounts, and environment configurations continue to work without modification.