@function
def build(self, source: dagger.Directory) -> dagger.Container:
"""Build a ready-to-use development environment"""
return (
dag.container()
.from_(self.buildenv_img)
.with_exec("pip install --upgrade pip".split(" "))
.with_exec("pip install --upgrade poetry".split(" "))
.with_exec("apk add podman buildah".split(" "))
.with_exec("echo ${PATH}".split(" "))
.with_exec("rm -rf /app".split(" "))
.with_exec("mkdir /app".split(" "))
.with_directory("/app", source)
.with_workdir("/app")
.with_env_variable("POETRY_NO_INTERACTION", "1")
.with_env_variable("POETRY_VIRTUALENVS_IN_PROJECT", "1")
.with_env_variable("POETRY_VIRTUALENVS_CREATE", "1")
.with_env_variable("POETRY_CACHE_DIR", "/tmp/poetry_cache")
.with_exec("poetry install".split(" "))
.with_env_variable("VIRTUAL_ENV", "/app/.venv")
.with_env_variable("PATH", "/app/.venv/bin:${PATH}")
.with_env_variable("PYTHONPATH", "${PYTHONPATH}:/app")
.with_exec("ansible-builder create -v3 --output-filename Dockerfile".split(" "))
.directory("/app/context")
.docker_build()
)
seems to work for now