1. Start with a small base image, e.g. for Python there's "python:3.7-slim". For Python I'm not a fan of Alpine, but for Go that gives you an extra small base image (see https://pythonspeed.com/articles/base-image-python-docker-im...).
2. Don't install unnecessary system packages (https://pythonspeed.com/articles/system-packages-docker/).
3. Multi-stage builds (in Python context, https://pythonspeed.com/articles/smaller-python-docker-image...).
You can find similar guides for non-Python as well. Basic idea being "don't install unnecessary stuff, and in final image only include the final build artifacts".
1. Start with a small base image, e.g. for Python there's "python:3.7-slim". For Python I'm not a fan of Alpine, but for Go that gives you an extra small base image (see https://pythonspeed.com/articles/base-image-python-docker-im...).
2. Don't install unnecessary system packages (https://pythonspeed.com/articles/system-packages-docker/).
3. Multi-stage builds (in Python context, https://pythonspeed.com/articles/smaller-python-docker-image...).
You can find similar guides for non-Python as well. Basic idea being "don't install unnecessary stuff, and in final image only include the final build artifacts".