instruction: Create a Dockerfile for Python with production best practices
output: ```dockerfile
  from its imageâs configuration. Containers come with default settings that usually work well, but you can change them if needed. These adjustments help the container's program run exactly how you want it to.For example, if you have an existing database container that listens on the standard port and you want to run a new instance of the same database container, then you might want to change the port settings the new container listens on so that it doesnât conflict with the existing container. Sometimes you might want to increase the memory available to the container if the program needs more resources to handle a heavy workload or set the environment variables to provide specific configuration details the program needs to function properly.The docker run command offers a powerful way to override these defaults and tailor the container's behavior to your liking. The command offers several flags that let you to customize container behavior on the fly.Here's a few ways you can achieve this.Overriding the network portsSometimes you might want to use separate database instances for development and testing purposes. Running these database instances on the same port might conflict. You can use the -p option in docker run to map container ports to host ports, allowing you to run the multiple instances of the container without any conflict.
  
  $ docker run -d -p HOST_PORT:CONTAINER_PORT postgres
  Setting environment variablesThis option sets an environment variable foo inside the container with the value bar.
  
  $ docker run -e foo=bar postgres env
  You will see output like the following:
  
  HOSTNAME=2042f2e6ebe4
  foo=bar
  
  TipThe .env file acts as a convenient way to set environment variables for your Docker containers without cluttering your command line with numerous -e flags. To use a .env file, you can pass --env-file option with the docker run command.
  
  $ docker run --env-file .env postgres env
  Restricting the container to consume the resourcesYou can use the --memory and --cpus flags with the docker run command to restrict how much CPU and memory a container can use. For example, you can set a memory limit for the Python API container, preventing it
  ```