qpixel
qpixel copied to clipboard
Improvements for Docker setup
Closes #1398
This PR is an overhaul of our Docker setup to make it more flexible and resilient. It includes:
- change of container
restartpolicy toon-failure:3(meaning 3 consequent failures cause containers to exit). Our current policy ofalwayssends containers in a restart loop if there is a fatal error, making it hard to debug and resolve issues; - removed obsolete
versionfield from docker-compose (just getting rid of an annoying warning); - removed mention of
sleepcommand from Docker docs as there is none (probably legacy?); - added Dockerfile.dev for setting up Docker specifically for local development purposes;
- when built with Dockerfile.dev, the uwsgi container no longer automatically starts Rails when run;
- made Dockerfile configurable via
.env(automatically created by local-setup.sh from compose-env).
Rationale for no longer auto-starting Rails when building with Dockerfile.dev:
- allows for live debugging in case there are issues that cause hard failures (currently, the container exits);
- prevents restart loops in case of hard failures (partially mitigated already by the restart policy change);
- the additional step (connecting to the container & running a single command) is fully documented in README.md.
Rationale for making Dockerfile used for the uwsgi container configurable:
- allows use of custom Docker build configurations as one sees fit as long as they set the
CLIENT_DOCKERFILEenvironment variable; - required to facilitate the use of Dockerfile.dev for development setups without the need to hard-code the changes;
- is backwards-compatible due to the default value of compose-env set to
docker/Dockerfile;