Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for docker compose files #1276

Open
asmaier opened this issue Jan 19, 2025 · 0 comments
Open

Support for docker compose files #1276

asmaier opened this issue Jan 19, 2025 · 0 comments

Comments

@asmaier
Copy link

asmaier commented Jan 19, 2025

Is your feature request related to a problem? Please describe

The new docker operations in pyinfra 3.x are really nice. But it would be even nicer if one could deploy a whole stack of docker containers using docker compose files. At the moment doing this is a bit of a hassle

files.directory(DIR_DOCKER)
files.directory(DIR_STORAGE)

for dir_name in ["umbrel"]:
    compose = files.put("apps/" + dir_name + "/docker-compose.yml", DIR_DOCKER + "/" + dir_name + "/docker-compose.yml")
    if compose.changed:
        server.shell("docker-compose down --remove-orphans && docker-compose up -d",
                     _shell_executable="zsh -l",
                     _chdir=DIR_DOCKER + "/" + dir_name,
                     _env={"DIR_STORAGE": storage_path})

Describe the solution you'd like

It would be nice to have a operation like

docker.stack("docker-compose.yml", _env={"DIR_STORAGE": storage_path}) 

which would make sure that the containers, networks and volumes defined in the compose file will run. The _env dictionary could be used to enable https://docs.docker.com/compose/how-tos/environment-variables/variable-interpolation/ within the docker-compose.yml file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant