Docker
These are docker guidelines that are a MUST for every developments.
- Docker support consists in 4 kind of files: compose.local.yaml (for local development), compose.dev.yaml (for development infrastructure), compose.test.yaml (for test infrastructure), compose.yaml (for production infrastructure)
- In local compose we use the build keyword; In others we use image keyword only, with related tag prefixs (dev,test,none x prod)
- With every environment comes a env file, this is done to avoid making errors in productions
- Loading env file (dotenv.load_dotenv) is not needed because it's loaded using env_file keyword (remember adding to .dockerignore to avoid sensible informations leaking)
- Pinning version in composes of used images it's good because we can get envrionments exactly as we expect in development
- Creating a .dockerignore file allow us to reduce images size, avoid info leaking
- Order in Dockerfile instructions matter, it can reduce the builds time
- All docker support files are stored in "docker"
- Provide healthcheck for services (es. PostgresDB, endpoint for webapp)
- It's prefered to use local mount instead of volumes because we can easily get the content from devops
- To build images that have private dependencies, we need to pass a token as argument (WIP)
- Use a proper container name with development name and code (ex. 123_geocoding)
- When a service has a external exposed port, we declare in ports keyword; When it's only for internal use, we declare in expose keyword
- In test, dev and prod it's convenient to set the restart policy to always
- IaC files (ex. scheduling files) can be stored in "iac"
folderfolder, and need to observe this guide - Continous Development it's handy to update code in different enviroments, we set by adding "cloud.eagleprojects.autocd.enable=true" in label list keyword