Create Dockerfile
Browse files- Dockerfile +34 -0
Dockerfile
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use an official Python runtime as the base image
|
2 |
+
FROM python:3.9-slim
|
3 |
+
|
4 |
+
# Set working directory
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# Install system dependencies
|
8 |
+
RUN apt-get update && apt-get install -y \
|
9 |
+
git \
|
10 |
+
libgl1-mesa-glx \
|
11 |
+
libglib2.0-0 \
|
12 |
+
&& rm -rf /var/lib/apt/lists/*
|
13 |
+
|
14 |
+
# Install Cog
|
15 |
+
RUN pip install cog==0.9.7
|
16 |
+
|
17 |
+
# Copy the repository files
|
18 |
+
COPY . .
|
19 |
+
|
20 |
+
# Install Python dependencies from requirements.txt
|
21 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
22 |
+
|
23 |
+
# Download weights at runtime using the HF_TOKEN from the environment
|
24 |
+
# Assuming script/download-weights uses HF_TOKEN env var
|
25 |
+
RUN echo "Weights will be downloaded at runtime using HF_TOKEN"
|
26 |
+
|
27 |
+
# Expose the port Cog typically uses
|
28 |
+
EXPOSE 5000
|
29 |
+
|
30 |
+
# Set environment variable to disable GPU (force CPU)
|
31 |
+
ENV CUDA_VISIBLE_DEVICES=""
|
32 |
+
|
33 |
+
# Command to run the Cog server, downloading weights if needed
|
34 |
+
CMD ["sh", "-c", "cog run script/download-weights $HF_TOKEN && cog run -p 5000"]
|