Initial commit

This commit is contained in:
2025-11-26 23:43:34 -06:00
commit d05a462c4d
9 changed files with 88 additions and 0 deletions

26
package.py Normal file
View File

@@ -0,0 +1,26 @@
import docker
from docker import DockerClient
# Container Management
## Build Image
def build(client: DockerClient, app: str):
with open(f"{app}/Dockerfile") as dockerfile:
image, _ = client.images.build(fileobj=dockerfile, tag="")
return image
## Run Image
def run(client: DockerClient, image, app: str):
container = client.containers.run(image, detach=True, name=app)
# Main Packaging Function
def pkg(app, version):
client = docker.from_env()
try:
image = build(client, app)
container = run(client, image, app)
except Exception as e:
print("Error")