Skip to content

Commit

Permalink
dagger: remove init main
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr <piotrzan@gmail.com>
  • Loading branch information
Piotr1215 committed Jun 13, 2024
1 parent e25f71e commit d5dede2
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions dagger/src/main/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ async def publish(self, source: dagger.Directory) -> str:
@function
def build(self, source: dagger.Directory) -> dagger.Container:
"""Build the application container"""
return (
build = (
self.build_env(source)
.with_exec(["hatch", "build"])
)
return (
dag.container()
.from_("python:3.10-slim")
.with_directory("/dist", build.directory("/src/dist"))
)

@function
async def test(self, source: dagger.Directory) -> str:
Expand Down Expand Up @@ -53,18 +58,3 @@ def build_env(self, source: dagger.Directory) -> dagger.Container:
.with_exec(["pip", "install", "inquirer"])
.with_exec(["pip", "install", "pytest"])
)


# Example usage:
if __name__ == "__main__":
import anyio

async def main():
async with dagger.Connection() as client:
source = await client.host().directory(".", exclude=[".git", "__pycache__"])
killercoda_cli = KillercodaCli()

build_result = await killercoda_cli.publish(source)
print(build_result)

anyio.run(main)

0 comments on commit d5dede2

Please sign in to comment.