-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
executable file
·48 lines (41 loc) · 1.52 KB
/
Copy pathdockerfile
File metadata and controls
executable file
·48 lines (41 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Use the official Python base image
FROM python:3.12.12-slim
# Set the working directory in the container
WORKDIR /app
# Copy project files
COPY pyproject.toml uv.lock* ./
# ----------------------------------------------------------------------
# Install UV and system dependencies
# UV provides much faster installation compared to pip
# ----------------------------------------------------------------------
RUN apt-get update && \
# Install FFmpeg and necessary libraries for Pillow (libjpeg, zlib)
# and Python compilation (build-essential)
apt-get install -y --no-install-recommends \
ffmpeg \
build-essential \
libjpeg-dev \
zlib1g-dev \
curl && \
\
# Install UV
curl -LsSf https://astral.sh/uv/install.sh | sh && \
export PATH="/root/.local/bin:$PATH" && \
\
# Install Python dependencies with UV (much faster than pip)
uv sync --frozen && \
\
# Cleanup: Remove build tools and cache to keep the image size minimal
apt-get purge -y build-essential curl && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
# ----------------------------------------------------------------------
# Add UV to PATH
ENV PATH="/root/.local/bin:$PATH"
# Copy the rest of the current directory's content into the container
COPY . .
# Expose the application's port
EXPOSE 8008
# *** UPDATED CMD INSTRUCTION ***
# Use uv run to execute uvicorn within the UV-managed environment
CMD ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8008"]