Skip to content

Commit

Permalink
[ADD] Example 1
Browse files Browse the repository at this point in the history
Simple Dockerfile returning python version
  • Loading branch information
ruiznorlan committed Jan 24, 2023
1 parent 6459d73 commit 5e18eb8
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
33 changes: 33 additions & 0 deletions 01-Dagger-Client/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import sys
import anyio
import dagger


async def test():
async with dagger.Connection(dagger.Config(log_output=sys.stderr)) as client:

# -------------------------------------------------------------------------
# EXAMPLE DOCKERFILE
# -------------------------------------------------------------------------
#
# FROM python:3.11-slim-buster
#
# CMD [ "python", "-V"]
#
# -------------------------------------------------------------------------

python = (
client.container()
# pull container
.from_("python:3.11-slim-buster")
# get Python version
.with_exec(["python", "-V"])
)

# execute
version = await python.stdout()

print(f"Hello from Dagger and {version}")

if __name__ == "__main__":
anyio.run(test)
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
# dagger_io_python
A programmable CI/CD engine that runs your pipelines in containers
# Dagger CI/CD (Python)

<img src="https://dagger.io/logo.svg" width="100">

----

## Descripción

Un motor de CI/CD programable que ejecutar sus pipelines en contenedores

## Tabla de contenidos
- [01-Dagger-Client](01-Dagger-Client)

0 comments on commit 5e18eb8

Please sign in to comment.