Lifecycle
lifecycle
¶
Defines Docker Compose lifecycle operations for the launcher
Thin, presentation-free wrappers over docker compose and docker build that
stream their output
build_images(repo_path, backend, source=ImageSource.BUILD)
¶
Builds the frontend and backend images from the checked out repo
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_path
|
Path
|
The managed source checkout root |
required |
backend
|
Backend
|
Selects the backend Dockerfile + Tag |
required |
source
|
ImageSource
|
Accepted for symmetry. Builds regardless |
BUILD
|
Yields:
| Type | Description |
|---|---|
str
|
Each line of build output |
Raises:
| Type | Description |
|---|---|
DependencyError
|
If Docker is not running |
BuildSourceError
|
If a Dockerfile or context is missing |
down(*, volumes=False, compose_file=None, project=PROJECT_NAME)
¶
Stops the application with docker compose down
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
volumes
|
bool
|
Also remove named data volumes when |
False
|
compose_file
|
Path | None
|
The resolved compose file, if available |
None
|
project
|
str
|
The compose project name |
PROJECT_NAME
|
Yields:
| Type | Description |
|---|---|
str
|
Each line of compose output |
Returns:
| Type | Description |
|---|---|
int
|
The compose exit code |
Raises:
| Type | Description |
|---|---|
DependnecyError
|
If Docker is not running |
CalledProcessError
|
If the command fails |
FileNotFoundError
|
If the Docker executable is not found |
logs(service=None, *, follow=False, tail=None, compose_file=None, project=PROJECT_NAME, handle=None)
¶
Streams container logs with docker compose logs
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
service
|
str | None
|
A single service to scope to, or all when |
None
|
follow
|
bool
|
Keep following new output when |
False
|
tail
|
int | None
|
Limit to the last N lines when given |
None
|
compose_file
|
Path | None
|
The resolved compose file, if available |
None
|
project
|
str
|
The compose project name |
PROJECT_NAME
|
handle
|
StreamHandle | None
|
An optional cancellation token to stop a followed stream on demand (e.g. a GUI "Stop" button). A run stopped through it ends cleanly rather than raising |
None
|
Yields:
| Type | Description |
|---|---|
str
|
Each log line |
Returns:
| Type | Description |
|---|---|
int
|
The compose exit code |
Raises:
| Type | Description |
|---|---|
DependencyError
|
If Docker is not running |
CalledProcessError
|
If the command fails |
FileNotFoundError
|
If the Docker executable is not found |
ps(*, compose_file=None, project=PROJECT_NAME)
¶
Returns the application's services as compose JSON
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
compose_file
|
Path | None
|
The resolved compose file, if available |
None
|
project
|
str
|
The compose project name |
PROJECT_NAME
|
Returns:
| Type | Description |
|---|---|
str
|
The raw |
Raises:
| Type | Description |
|---|---|
DependencyError
|
If Docker is not running |
CalledProcessError
|
If the command fails |
FileNotFoundError
|
If the Docker executable is not found |
pull(compose_file, *, env_file=None, project=PROJECT_NAME)
¶
Pulls the application's pre-built images with docker compose pull
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
compose_file
|
Path
|
The resolved compose file |
required |
env_file
|
Path | None
|
A |
None
|
project
|
str
|
The compose project name |
PROJECT_NAME
|
Yields:
| Type | Description |
|---|---|
str
|
Each line of compose output |
Returns:
| Type | Description |
|---|---|
int
|
The compose exit code |
Raises:
| Type | Description |
|---|---|
DependnecyError
|
If Docker is not running |
CalledProcessError
|
If the command fails |
FileNotFoundError
|
If the Docker executable is not found |
up(compose_file, *, env_file=None, detach=True, project=PROJECT_NAME)
¶
Starts the application with docker compose up
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
compose_file
|
Path
|
The resolved compose file to run |
required |
env_file
|
Path | None
|
A |
None
|
detach
|
bool
|
Run detached when |
True
|
project
|
str
|
The compose project name |
PROJECT_NAME
|
Yields:
| Type | Description |
|---|---|
str
|
Each line of compose output |
Returns:
| Type | Description |
|---|---|
int
|
The compose exit code |
Raises:
| Type | Description |
|---|---|
DependnecyError
|
If Docker is not running |
CalledProcessError
|
If the command fails |
FileNotFoundError
|
If the Docker executable is not found |