Technologic101 commited on
Commit
a02fd42
·
1 Parent(s): c5d3c0b

build: convert to uv

Browse files
Files changed (3) hide show
  1. Dockerfile +19 -35
  2. pyproject.toml +35 -37
  3. requirements.txt +24 -0
Dockerfile CHANGED
@@ -1,47 +1,31 @@
1
- # Use Python 3.11 slim image
2
- FROM python:3.11-slim
3
 
4
- # Run system updates and installations as root
5
- RUN apt-get update && apt-get install -y \
6
- curl \
7
- build-essential \
8
- && rm -rf /var/lib/apt/lists/*
9
 
10
- # Install Poetry
11
- RUN pip install poetry
12
-
13
- # Create app directory with correct permissions
14
- RUN mkdir /app && chown -R 1000:1000 /app
15
-
16
- # Create non-root user
17
  RUN useradd -m -u 1000 user
18
-
19
- # Switch to non-root user
20
  USER user
21
- WORKDIR /app
22
 
23
- # Set up environment variables
24
- ENV PYTHONPATH=/app
25
- ENV PORT=7860
26
- ENV CHAINLIT_HOST="0.0.0.0"
27
- ENV CHAINLIT_PORT=7860
28
 
29
- # Configure Poetry
30
- RUN poetry config virtualenvs.create true \
31
- && poetry config virtualenvs.in-project true
32
 
33
- # Copy dependency files with correct ownership
34
- COPY --chown=user pyproject.toml poetry.lock* ./
35
- COPY --chown=user chainlit.yaml ./
36
 
37
- # Install dependencies in virtualenv
38
- RUN poetry install --no-root --no-interaction --no-ansi
39
 
40
- # Copy application code
41
- COPY --chown=user . .
 
42
 
43
- # Expose the port Chainlit runs on
44
  EXPOSE 7860
45
 
46
- # Command to run the Chainlit app
47
- CMD ["poetry", "run", "chainlit", "run", "src/app.py", "--host", "0.0.0.0", "--port", "7860", "--headless"]
 
 
 
1
 
2
+ # Get a distribution that has uv already installed
3
+ FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
 
 
 
4
 
5
+ # Add user - this is the user that will run the app
6
+ # If you do not set user, the app will run as root (undesirable)
 
 
 
 
 
7
  RUN useradd -m -u 1000 user
 
 
8
  USER user
 
9
 
10
+ # Set the home directory and path
11
+ ENV HOME=/home/user \
12
+ PATH=/home/user/.local/bin:$PATH
13
+
14
+ ENV UVICORN_WS_PROTOCOL=websockets
15
 
 
 
 
16
 
17
+ # Set the working directory
18
+ WORKDIR $HOME/app
 
19
 
20
+ # Copy the app to the container
21
+ COPY --chown=user . $HOME/app
22
 
23
+ # Install the dependencies
24
+ # RUN uv sync --frozen
25
+ RUN uv sync
26
 
27
+ # Expose the port
28
  EXPOSE 7860
29
 
30
+ # Run the app
31
+ CMD ["uv", "run", "chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]
pyproject.toml CHANGED
@@ -1,40 +1,42 @@
1
- [tool.poetry]
2
  name = "imagineui"
3
  version = "0.1.0"
4
  description = "An AI-powered CSS style generator using CSS Zen Garden designs"
5
- authors = ["Anthony Chapman <[email protected]>"]
 
 
6
  readme = "README.md"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
- [project]
9
- name = "imagineui"
10
- python = ">=3.9,<4.0"
11
-
12
- [tool.poetry.dependencies]
13
- python = ">=3.9,<4.0"
14
- jupyter = "*"
15
- notebook = "*"
16
- ipykernel = ">=6.29.0"
17
- beautifulsoup4 = ">=4.12.0"
18
- scrapy = ">=2.11.0"
19
- playwright = ">=1.42.0"
20
- pandas = ">=2.2.0"
21
- numpy = ">=1.26.0"
22
- langchain = ">=0.1.0"
23
- langgraph = ">=0.0.19"
24
- chainlit = ">=0.7.700"
25
- transformers = ">=4.37.0"
26
- datasets = ">=2.17.0"
27
- torch = "2.1.2"
28
- sentence-transformers = ">=2.5.0"
29
- python-dotenv = ">=1.0.0"
30
- requests = ">=2.28.1"
31
- openai = ">=1.63.2,<2.0.0"
32
- langchain-openai = ">=0.3.6,<0.4.0"
33
- langchain-community = ">=0.3.18,<0.4.0"
34
- faiss-cpu = "^1.7.4"
35
- jq = "^1.8.0"
36
- ragas = "^0.2.13"
37
- rapidfuzz = "^3.12.1"
38
 
39
  [tool.black]
40
  line-length = 88
@@ -62,8 +64,4 @@ testpaths = ["tests"]
62
  python_version = "3.11"
63
  warn_return_any = true
64
  warn_unused_configs = true
65
- check_untyped_defs = true
66
-
67
- [build-system]
68
- requires = ["poetry-core"]
69
- build-backend = "poetry.core.masonry.api"
 
1
+ [project]
2
  name = "imagineui"
3
  version = "0.1.0"
4
  description = "An AI-powered CSS style generator using CSS Zen Garden designs"
5
+ authors = [
6
+ {name = "Anthony Chapman", email = "[email protected]"}
7
+ ]
8
  readme = "README.md"
9
+ requires-python = ">=3.9,<4.0"
10
+ dependencies = [
11
+ "jupyter",
12
+ "notebook",
13
+ "ipykernel>=6.29.0",
14
+ "beautifulsoup4>=4.12.0",
15
+ "scrapy>=2.11.0",
16
+ "playwright>=1.42.0",
17
+ "pandas>=2.2.0",
18
+ "numpy>=1.26.0",
19
+ "langchain>=0.1.0",
20
+ "langgraph>=0.0.19",
21
+ "chainlit>=0.7.700",
22
+ "transformers>=4.37.0",
23
+ "datasets>=2.17.0",
24
+ "torch==2.1.2",
25
+ "sentence-transformers>=2.5.0",
26
+ "python-dotenv>=1.0.0",
27
+ "requests>=2.28.1",
28
+ "openai>=1.63.2,<2.0.0",
29
+ "langchain-openai>=0.3.6,<0.4.0",
30
+ "langchain-community>=0.3.18,<0.4.0",
31
+ "faiss-cpu>=1.7.4",
32
+ "jq>=1.8.0",
33
+ "ragas>=0.2.13",
34
+ "rapidfuzz>=3.12.1"
35
+ ]
36
 
37
+ [build-system]
38
+ requires = ["hatchling"]
39
+ build-backend = "hatchling.build"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
  [tool.black]
42
  line-length = 88
 
64
  python_version = "3.11"
65
  warn_return_any = true
66
  warn_unused_configs = true
67
+ check_untyped_defs = true
 
 
 
 
requirements.txt ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jupyter
2
+ notebook
3
+ ipykernel>=6.29.0
4
+ beautifulsoup4>=4.12.0
5
+ scrapy>=2.11.0
6
+ playwright>=1.42.0
7
+ pandas>=2.2.0
8
+ numpy>=1.26.0
9
+ langchain>=0.1.0
10
+ langgraph>=0.0.19
11
+ chainlit>=0.7.700
12
+ transformers>=4.37.0
13
+ datasets>=2.17.0
14
+ torch==2.1.2
15
+ sentence-transformers>=2.5.0
16
+ python-dotenv>=1.0.0
17
+ requests>=2.28.1
18
+ openai>=1.63.2,<2.0.0
19
+ langchain-openai>=0.3.6,<0.4.0
20
+ langchain-community>=0.3.18,<0.4.0
21
+ faiss-cpu>=1.7.4
22
+ jq>=1.8.0
23
+ ragas>=0.2.13
24
+ rapidfuzz>=3.12.1