AmirTrader commited on
Commit
df6b3da
·
verified ·
1 Parent(s): 561706e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -41
Dockerfile CHANGED
@@ -1,46 +1,16 @@
1
- # Use a specialized UV image for building
2
- FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder
3
 
4
- # Enable bytecode compilation and set UV options
5
- ENV UV_COMPILE_BYTECODE=1
6
- ENV UV_LINK_MODE=copy
7
 
8
- WORKDIR /app
 
 
9
 
10
- # Install dependencies separately to leverage Docker layer caching
11
- # This uses cache mounts for the uv cache and binds for configuration files
12
- RUN --mount=type=cache,target=/root/.cache/uv \
13
- --mount=type=bind,source=uv.lock,target=uv.lock \
14
- --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
15
- uv sync --frozen --no-install-project --no-dev
16
 
17
- # Copy the rest of the application code
18
- COPY . /app
19
 
20
- # Sync the project (installs the current project package)
21
- RUN --mount=type=cache,target=/root/.cache/uv \
22
- uv sync --frozen --no-dev
23
-
24
-
25
- # --- Final Stage ---
26
- FROM python:3.12-slim-bookworm
27
-
28
- # Set environment variables
29
- ENV PYTHONUNBUFFERED=1
30
- ENV PATH="/app/.venv/bin:$PATH"
31
-
32
- WORKDIR /app
33
-
34
- # Copy the synced environment from the builder
35
- COPY --from=builder /app /app
36
-
37
- # Create necessary cache directories with appropriate permissions
38
- # (Useful for certain cloud environments or local dockers)
39
- RUN mkdir -p /.cache && chmod 777 /.cache
40
-
41
- # Expose the dashboard port
42
- EXPOSE 5010
43
-
44
- # Run the Panel dashboard
45
- # Using direct 'panel serve' as it's more robust in container environments
46
- CMD ["panel", "serve", "dashboard.py", "--address", "0.0.0.0", "--port", "5010", "--allow-websocket-origin", "*"]
 
1
+ FROM python:3.12-slim
 
2
 
3
+ WORKDIR /code
 
 
4
 
5
+ COPY ./requirements.txt /code/requirements.txt
6
+ RUN python3 -m pip install --no-cache-dir --upgrade pip
7
+ RUN python3 -m pip install --no-cache-dir --upgrade -r /code/requirements.txt
8
 
9
+ COPY . .
 
 
 
 
 
10
 
11
+ CMD ["panel", "serve", "/code/app.py", "--address", "0.0.0.0", "--port", "7860", "--allow-websocket-origin", "*"]
 
12
 
13
+ RUN mkdir /.cache
14
+ RUN chmod 777 /.cache
15
+ RUN mkdir .chroma
16
+ RUN chmod 777 .chroma