- Keep containers stateless.
- Use COPY instead of ADD.
- Make COPY last line before CMD or ENTRYPOINT.
- Each line in the Dockerfile is cached.
- Separate COPY of requirements.txt from source code.
- CMD vs ENTRYPOINT: ENTRYPOINT is the main command. Treat CMD as the default flag for the entrypoint. Example: