{pkgs?import<nixpkgs>{system="aarch64-linux";}}:let# Nasz skrypt Pythona (zamiast pliku app.py)myApp=pkgs.writeScriptBin"app"'' #!${pkgs.python3}/bin/python import socket server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind(('0.0.0.0', 8080)) server.listen(1) print("Nasluchuje...") while True: conn, addr = server.accept() conn.sendall(b"Hello z Nix Distroless!\n") conn.close() '';inpkgs.dockerTools.buildLayeredImage{name="nix-python-distroless";tag="latest";# Co ma się znaleźć w kontenerze. Zależności (np. Python) Nix wyliczy sam!contents=[myApp];config={Cmd=["${myApp}/bin/app"];ExposedPorts={"8080/tcp"={};};};}
Top comments (0)
Subscribe
We're a place where coders share, stay up-to-date and grow their careers.
Top comments (0)