From c13c4e9420d3c75c5a0c598801f319e9480a8da3 Mon Sep 17 00:00:00 2001 From: Nick Schenone Date: Mon, 14 Oct 2024 09:15:08 -0700 Subject: [PATCH] Improved Makefile and controller Dockerfile (#27) * Optimized dockerfile to prevent re-installing dependencies on every code change * Updated outdated docker compose syntax in Makefile * Updated Makefile with up/down/help commands * Updated Makefile --- Makefile | 19 ++++++++++++++++--- controller/Dockerfile | 10 ++++++---- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 8e14a12..cae01cb 100644 --- a/Makefile +++ b/Makefile @@ -14,14 +14,27 @@ CONTROLLER_NAME = "genai-factory-controller" -.PHONY: genai-factory -genai-factory: +.PHONY: help +help: ## Display available commands + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +.PHONY: all +all: + $(error please pick a target) + +.PHONY: up +up: ## Deploy GenAI factory controller and UI # Build the Docker image using the - docker-compose up -d --build + docker compose up -d --build @echo "GenAI Factory Controller and UI application are running in the background" @echo "UI application is available at http://localhost:3000" @echo "Controller API is available at http://localhost:8001" +.PHONY: down +down: ## Stop GenAI factory controller and UI + # Build the Docker image using the + docker compose down + .PHONY: controller controller: # Build controller's image: diff --git a/controller/Dockerfile b/controller/Dockerfile index f220ca1..077db93 100644 --- a/controller/Dockerfile +++ b/controller/Dockerfile @@ -29,15 +29,17 @@ RUN apt update -qqq \ && rm -rf /var/lib/apt/lists/* \ WORKDIR /controller -COPY /controller/src /controller/src + +# Install requirements: COPY /controller/requirements.txt /controller/ +RUN pip install -r /controller/requirements.txt + +# Copy controller source code +COPY /controller/src /controller/src # Make the data directory: RUN mkdir -p ../data -# Install requirements: -RUN pip install -r /controller/requirements.txt - # Set python path environment variable: ENV PYTHONPATH="/controller/src" ENV CTRL_DATA_PATH="/data"