build: Improved the Dockerfile to make the project less hostile to use with docker #113
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem: Some behaviors of the project are hostile to use in a docker environment, that includes:
Solution: Refactor the Dockerfile to change default locations for the .json files and add support for a different location for the db.json
I've refactored the Dockerfile to set ENVs changing the default location for all the config files (read using readConfigPathsFromENV) to be in the /root folder (root's home), this allow easy mapping of the /root folder to a volume
The user for the docker process was also removed, it's now the default root user - A different user for the docker process is only useful in very specific cases, in general, it's not a problem to run the process as root since the container is already an isolated environment; and, since it was causing permission problems for the volume mountpoints, I've removed it
I've also refactored the Dockerfile to use two stages, one for build and other for the live image, that should reduce the image size and reduce the code shipped in the image. The behavior is the same
The only change in program code was the addition of the CONFIG_DB_PATH to allow specifying a different path for the db and the db initialization to use that config instead of the hardcoded 'db.json'. All the other changes were in the Dockerfile and should only affect docker images