-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (34 loc) · 1.18 KB
/
Dockerfile
File metadata and controls
46 lines (34 loc) · 1.18 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
FROM python:3.14-slim
# Set working directory
WORKDIR /app
# Install system dependencies (sorted alphanumerically)
RUN apt-get update && apt-get install -y \
build-essential \
curl \
libmagic-dev \
libmagic1 \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Create necessary directories
RUN mkdir -p documents indexes logs temp backups media staticfiles
# Set Django settings module
ENV DJANGO_SETTINGS_MODULE=django_app.settings
# Collect static files for Django and create non-root user for security
RUN python manage.py collectstatic --noinput || true && \
useradd -m -u 1000 raguser && \
chown -R raguser:raguser /app
# Switch to non-root user
USER raguser
# Expose ports
EXPOSE 8000 8001 8501
# Health check for Django
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/api/health/ || exit 1
# Default command - Django server
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]