-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.cpu
More file actions
52 lines (43 loc) · 1.46 KB
/
Dockerfile.cpu
File metadata and controls
52 lines (43 loc) · 1.46 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
49
50
51
52
FROM python:3.11-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
ffmpeg \
libpq-dev \
gcc \
git \
cmake \
libavcodec-dev \
libavfilter-dev \
libavformat-dev \
libavutil-dev \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir /code
WORKDIR /code
# Copy and install Python dependencies first (cached unless requirements.txt changes)
COPY requirements.txt /code/
RUN --mount=type=cache,target=/root/.cache/pip \
pip install -r requirements.txt
# Install CPU-only PyTorch
RUN --mount=type=cache,target=/root/.cache/pip \
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
# Build and install decord from fork (CPU-only)
RUN git clone --recursive https://github.com/evz/decord /tmp/decord && \
cd /tmp/decord && \
mkdir build && \
cd build && \
cmake .. -DUSE_CUDA=0 -DCMAKE_BUILD_TYPE=Release && \
make && \
cd /tmp/decord/python && \
python3 setup.py install && \
rm -rf /tmp/decord
# Copy MegaDetector model to avoid re-downloading on every container start
COPY models/md_v5a.0.0.pt /models/md_v5a.0.0.pt
ENV MDV5A=/models/md_v5a.0.0.pt
# Copy application files last (invalidated when code changes, but deps stay cached)
COPY docker-entrypoint.sh /code/
RUN chmod a+x /code/docker-entrypoint.sh
COPY manage.py /code/
COPY video_processor /code/video_processor
COPY processor /code/processor
EXPOSE 8000
ENTRYPOINT ["/code/docker-entrypoint.sh"]