Before I run my apps in K8s I need to make Docker images of all my apps. Help me to make…
- User
Before I run my apps in K8s I need to make Docker images of all my apps. Help me to make production ready super professional Docker images for my apps. I will give you my Docker file for Diamonds Service that I use to run it locally with Docker-compose to run tests and test it manually. It works, but I need to make it production ready robust and clean! For example I use uvicorn there with reload because it is recommended for FastAPI to test and debug, but as fun as I know in production FastAPI app usually use Gunicorn in combination with Uvicorn (often referred to as gunicorn + uvicorn workers) to take advantage of Gunicorn’s robust process management. Make it the best you can, as if you are SRE/DevOps from Super BugTech company. Here is my Docker file: FROM python:3.11-slim-bullseye
RUN apt-get update &&
apt-get install -y gcc libpq-dev &&
apt clean &&
rm -rf /var/cache/apt/*ENV PYTHONDONTWRITEBYTECODE=1
PYTHONUNBUFFERED=1
PYTHONIOENCODING=utf-8COPY ./diamonds-domain ./diamonds-domain COPY ./diamonds-service /src
RUN pip install -U pip &&
pip install poetryWORKDIR /src
ENV PYTHONPATH="/src:/src/src"
RUN poetry config virtualenvs.create false &&
poetry install --no-root --no-interaction --no-ansiENV DEFAULT_MODULE_NAME=main
ENV MODULE_NAME={MODULE_NAME:-DEFAULT_MODULE_NAME} ENV VARIABLE_NAME={APP_MODULE:-"VARIABLE_NAME"}
- Assistant