mirror of
https://github.com/containers/podman-compose.git
synced 2025-04-25 09:59:02 +02:00
resolve
This commit is contained in:
parent
34ec4b3cb9
commit
3343910763
18
README.md
18
README.md
@ -6,10 +6,19 @@ This project is aimed to provide drop-in replacement for `docker-compose`,
|
|||||||
and it's very useful for certain cases because:
|
and it's very useful for certain cases because:
|
||||||
|
|
||||||
- can run rootless
|
- can run rootless
|
||||||
- only depend on `podman` and Python3 and [PyYAML](https://pyyaml.org/)
|
|
||||||
- no daemon, no setup.
|
- no daemon, no setup.
|
||||||
- can be used by developers to run single-machine containerized stacks using single familiar YAML file
|
- can be used by developers to run single-machine containerized stacks using single familiar YAML file
|
||||||
|
|
||||||
|
This project only depend on:
|
||||||
|
|
||||||
|
* `podman`
|
||||||
|
* Python3
|
||||||
|
* [PyYAML](https://pyyaml.org/)
|
||||||
|
* [python-dotenv](https://pypi.org/project/python-dotenv/)
|
||||||
|
|
||||||
|
And it's formed as a single python file script that you can drop into your PATH and run.
|
||||||
|
|
||||||
|
|
||||||
For production-like single-machine containerized environment consider
|
For production-like single-machine containerized environment consider
|
||||||
|
|
||||||
- [k3s](https://k3s.io) | [k3s github](https://github.com/rancher/k3s)
|
- [k3s](https://k3s.io) | [k3s github](https://github.com/rancher/k3s)
|
||||||
@ -20,9 +29,12 @@ For production-like single-machine containerized environment consider
|
|||||||
For the real thing (multi-node clusters) check any production
|
For the real thing (multi-node clusters) check any production
|
||||||
OpenShift/Kubernetes distribution like [OKD](https://www.okd.io/minishift/).
|
OpenShift/Kubernetes distribution like [OKD](https://www.okd.io/minishift/).
|
||||||
|
|
||||||
## NOTE
|
## Versions
|
||||||
|
|
||||||
This project is still under development.
|
If you have legacy version of `podman` (before 3.x) you might need to stick with legacy `podman-compose` `0.1.x` branch.
|
||||||
|
The legacy branch 0.1.x uses mappings and workarounds to compensate for rootless limitations.
|
||||||
|
|
||||||
|
Modern podman versions (>=3.4) do not have those limitations and thus you can use latest and stable 1.x branch.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ except ImportError:
|
|||||||
# import fnmatch
|
# import fnmatch
|
||||||
# fnmatch.fnmatchcase(env, "*_HOST")
|
# fnmatch.fnmatchcase(env, "*_HOST")
|
||||||
|
|
||||||
import json
|
|
||||||
import yaml
|
import yaml
|
||||||
|
from dotenv import dotenv_values
|
||||||
|
|
||||||
__version__ = '0.1.9'
|
__version__ = '0.1.9'
|
||||||
|
|
||||||
@ -1001,6 +1001,10 @@ def resolve_extends(services, service_names, environ):
|
|||||||
new_service = rec_merge({}, from_service, service)
|
new_service = rec_merge({}, from_service, service)
|
||||||
services[name] = new_service
|
services[name] = new_service
|
||||||
|
|
||||||
|
def dotenv_to_dict(dotenv_path):
|
||||||
|
if not os.path.isfile(dotenv_path):
|
||||||
|
return {}
|
||||||
|
return dotenv_values(dotenv_path)
|
||||||
|
|
||||||
class PodmanCompose:
|
class PodmanCompose:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -1113,10 +1117,7 @@ class PodmanCompose:
|
|||||||
|
|
||||||
dotenv_path = os.path.join(dirname, ".env")
|
dotenv_path = os.path.join(dirname, ".env")
|
||||||
self.environ = dict(os.environ)
|
self.environ = dict(os.environ)
|
||||||
if os.path.isfile(dotenv_path):
|
self.environ.update(dotenv_to_dict(dotenv_path))
|
||||||
with open(dotenv_path, 'r') as f:
|
|
||||||
dotenv_ls = [l.strip() for l in f if l.strip() and not l.startswith('#')]
|
|
||||||
self.environ.update(dict([l.split("=", 1) for l in dotenv_ls if "=" in l]))
|
|
||||||
# TODO: should read and respect those env variables
|
# TODO: should read and respect those env variables
|
||||||
# see: https://docs.docker.com/compose/reference/envvars/
|
# see: https://docs.docker.com/compose/reference/envvars/
|
||||||
# see: https://docs.docker.com/compose/env-file/
|
# see: https://docs.docker.com/compose/env-file/
|
||||||
|
@ -3,3 +3,5 @@
|
|||||||
# process, which may cause wedges in the gate later.
|
# process, which may cause wedges in the gate later.
|
||||||
|
|
||||||
pyyaml
|
pyyaml
|
||||||
|
python-dotenv
|
||||||
|
|
||||||
|
3
setup.py
3
setup.py
@ -36,7 +36,8 @@ setup(
|
|||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
license='GPL-2.0-only',
|
license='GPL-2.0-only',
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'pyyaml'
|
'pyyaml',
|
||||||
|
'python-dotenv',
|
||||||
],
|
],
|
||||||
# test_suite='tests',
|
# test_suite='tests',
|
||||||
# tests_require=[
|
# tests_require=[
|
||||||
|
Loading…
Reference in New Issue
Block a user