fix: improve docker security, reliability and default performance #213
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.
This pull request updates the Docker configuration for the API service to improve security and reliability. The main changes include installing additional dependencies, creating necessary data directories, and ensuring the application runs under a non-root user. The startup command is also updated to use
gunicorninstead ofuvicorndirectly, and ownership of data directories is enforced at container startup.Security and User Management:
gitandopenssh-clientin the API Docker image to support repository cloning and SSH operations.appuserat container startup in both production and development compose files, usingsu appuser. [1] [2]Data Directory Setup:
/app/data/user_filesand/app/data/cloned_reposdirectories in the Docker image to ensure required paths exist for user files and cloned repositories./app/databyappuserat container startup to avoid permission issues. [1] [2]Application Startup Improvements:
gunicornwith the Uvicorn worker for improved production reliability, replacing the previous directuvicorninvocation. [1] [2]USER appuserdirective from the Dockerfile to allow dynamic user switching at runtime via the compose command.