Update Dockerfile
Browse files- Dockerfile +38 -0
Dockerfile
CHANGED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
2 |
+
FROM python:3.9-slim
|
3 |
+
|
4 |
+
# Set environment variables
|
5 |
+
ENV PYTHONDONTWRITEBYTECODE 1
|
6 |
+
ENV PYTHONUNBUFFERED 1
|
7 |
+
ENV HF_HOME=/data/hf_cache
|
8 |
+
ENV TRANSFORMERS_CACHE=/data/hf_cache/txagent_models
|
9 |
+
|
10 |
+
# Create and set working directory
|
11 |
+
WORKDIR /app
|
12 |
+
|
13 |
+
# Install system dependencies
|
14 |
+
RUN apt-get update && apt-get install -y \
|
15 |
+
build-essential \
|
16 |
+
libpoppler-cpp-dev \
|
17 |
+
pkg-config \
|
18 |
+
python3-dev \
|
19 |
+
&& rm -rf /var/lib/apt/lists/*
|
20 |
+
|
21 |
+
# Install Python dependencies
|
22 |
+
COPY requirements.txt .
|
23 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
24 |
+
|
25 |
+
# Create necessary directories
|
26 |
+
RUN mkdir -p /data/hf_cache/txagent_models \
|
27 |
+
/data/hf_cache/tool_cache \
|
28 |
+
/data/hf_cache/cache \
|
29 |
+
/data/hf_cache/reports
|
30 |
+
|
31 |
+
# Copy the application code
|
32 |
+
COPY . .
|
33 |
+
|
34 |
+
# Expose the port the app runs on
|
35 |
+
EXPOSE 7860
|
36 |
+
|
37 |
+
# Command to run the application
|
38 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|