docker
dev_tool.config.docker
log = logging.getLogger(__name__)
module-attribute
DockerConfig
A class for managing Docker configuration settings.
This class provides methods for creating default Docker configurations based on environment variables and user settings.
The constructor for the DockerConfig class.
Source code in dev_tool/config/docker.py
create_default_docker_config
A method that creates a default Docker configuration dictionary.
This method combines user-provided configuration with environment variables to create a complete Docker container configuration.
Parameters:
-
container_name(str) –The name to use for the Docker container.
-
docker_config(dict) –The user-provided Docker configuration dictionary.
-
host_port(int) –The host port to publish the database on.
Returns:
-
dict–A complete Docker configuration dictionary.
Source code in dev_tool/config/docker.py
get_app_port
A method that retrieves the host port the project's web server binds to.
The APP_PORT environment variable wins. Otherwise the port is the default, or in multi-project mode it is derived from the project name so every project publishes its server on a port of its own.
Parameters:
-
project_name(str) –The project name the port is derived from.
-
multi_project(bool) –Whether this machine runs several projects at once.
Returns:
-
int–The host port for the web server.
Source code in dev_tool/config/docker.py
get_database_port
A method that retrieves the host port the project's database is published on.
Outside multi-project mode the port set in the environment file wins, and the default applies without one. In multi-project mode a configured port still wins, except for the bare 5432 default that every project carries and which is therefore read as no choice at all. Without a choice the port is derived from the project name, so every project publishes its database on a port of its own.
Parameters:
-
project_name(str) –The project name the port is derived from.
-
configured(str | None) –The port set in the environment file, if any.
-
multi_project(bool) –Whether this machine runs several projects at once.
Returns:
-
int–The host port for the database.
Source code in dev_tool/config/docker.py
get_dockerfile_path
Get the Dockerfile path - project Dockerfile takes precedence over default.
Returns:
-
Path | None–Path to Dockerfile to use, or None if using standard postgres image
Source code in dev_tool/config/docker.py
get_ssh_port
A method that retrieves the host port the project's app container exposes SSH on.
The SSH_PORT environment variable wins. Otherwise the port is the default, or in multi-project mode it is derived from the project name so every project publishes SSH on a port of its own.
Parameters:
-
project_name(str) –The project name the port is derived from.
-
multi_project(bool) –Whether this machine runs several projects at once.
Returns:
-
int–The host port for SSH.
Source code in dev_tool/config/docker.py
set_notification
A method that sets the notification service.
Parameters:
-
notification(NotificationProtocol) –The notification service to use.
set_resource_path_getter
A method that sets the resource path getter function.
Parameters: