-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathDockerfile.backend.prod
More file actions
58 lines (48 loc) · 1.53 KB
/
Copy pathDockerfile.backend.prod
File metadata and controls
58 lines (48 loc) · 1.53 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
53
54
55
56
57
58
FROM python:3.12-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
netcat-traditional \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
RUN crawl4ai-setup
# Copy application code
COPY backend/app ./app
COPY backend/alembic.ini .
COPY backend/alembic ./alembic
COPY backend/scripts ./scripts
COPY backend/assets ./assets
# Create required directories including cache directories
RUN mkdir -p uploads/agents && \
mkdir -p temp && \
mkdir -p .cache/huggingface/transformers && \
mkdir -p .cache/huggingface/sentence_transformers && \
mkdir -p .cache/huggingface/hub && \
mkdir -p .cache/torch && \
mkdir -p .cache/pytorch_transformers && \
chmod -R 755 .cache && \
chmod -R 755 temp
# Make startup script executable
RUN chmod +x ./scripts/start.sh
# Set environment variables
ENV PYTHONPATH=/app
ENV PORT=8000
ENV ENVIRONMENT=production
# Set HuggingFace cache directories
ENV HF_HOME=/app/.cache/huggingface
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/transformers
ENV SENTENCE_TRANSFORMERS_HOME=/app/.cache/huggingface/sentence_transformers
ENV HF_HUB_CACHE=/app/.cache/huggingface/hub
ENV HF_HUB_DISABLE_TELEMETRY=1
# Set PyTorch cache directories
ENV TORCH_HOME=/app/.cache/torch
ENV PYTORCH_TRANSFORMERS_CACHE=/app/.cache/pytorch_transformers
# Expose the port
EXPOSE 8000
# Run the startup script
CMD ["./scripts/start.sh"]