diff --git a/src/litserve/docker_builder.py b/src/litserve/docker_builder.py index 6ad3afb5..e1708798 100644 --- a/src/litserve/docker_builder.py +++ b/src/litserve/docker_builder.py @@ -27,17 +27,18 @@ logger.addHandler(console_handler) # COLOR CODES -BOLD = "\u001b[1m" RESET = "\u001b[0m" RED = "\u001b[31m" GREEN = "\u001b[32m" BLUE = "\u001b[34m" MAGENTA = "\u001b[35m" +BG_MAGENTA = "\u001b[45m" # ACTION CODES -INFO = f"{BOLD}{BLUE}[INFO]{RESET}" -BOLD_ACT = f"{BOLD}{MAGENTA}" -WARNING = f"{BOLD}{RED}[WARNING]{RESET}" +BOLD = "\u001b[1m" +UNDERLINE = "\u001b[4m" +INFO = f"{BOLD}{BLUE}[INFO]" +WARNING = f"{BOLD}{RED}[WARNING]" def color(text, color_code, action_code=None): @@ -58,10 +59,12 @@ def color(text, color_code, action_code=None): """ SUCCESS_MSG = """ -Dockerfile created successfully at {dockerfile_path}. -- To build the Docker image, run: docker build -t . -- To run the Docker container, run: docker run -p : -- To push the Docker image to a registry, run: docker push +{BOLD}{MAGENTA}Dockerfile created successfully at{RESET} {UNDERLINE}{dockerfile_path}{RESET} + +{BOLD}{BLUE}To build the Docker image, run: {UNDERLINE}docker build -t .{RESET} +- To build the Docker image, run: {UNDERLINE}docker build -t .{RESET} +- To run the Docker container, run: {UNDERLINE}docker run -p : {RESET} +- To push the Docker image to a registry, run: {UNDERLINE}docker push {RESET} """ @@ -95,5 +98,14 @@ def build(server_path: str, port: int = 8000): ) with open("Dockerfile", "w") as f: f.write(dockerfile_content) - success_msg = SUCCESS_MSG.format(dockerfile_path=os.path.abspath("Dockerfile")) + success_msg = SUCCESS_MSG.format( + dockerfile_path=os.path.abspath("Dockerfile"), + BOLD=BOLD, + MAGENTA=MAGENTA, + GREEN=GREEN, + BLUE=BLUE, + UNDERLINE=UNDERLINE, + BG_MAGENTA=BG_MAGENTA, + RESET=RESET, + ) print(success_msg)