-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (24 loc) · 983 Bytes
/
Dockerfile
File metadata and controls
32 lines (24 loc) · 983 Bytes
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
FROM python:3.10-slim
# Install system dependencies including sqlite3
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
sqlite3 \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Create a data directory that we will mount as a persistent volume
RUN mkdir -p /app/data
# Expose port
EXPOSE 8000
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV DJANGO_SETTINGS_MODULE="pdf_chat_project.settings"
# Default DATA_DIR (can be overridden by k8s but this is a fallback)
ENV DATA_DIR="/app/data"
# Command to run the application using Gunicorn
CMD ["sh", "-c", "python manage.py migrate && python manage.py collectstatic --noinput && gunicorn pdf_chat_project.wsgi:application --bind 0.0.0.0:8000 --workers 3 --forwarded-allow-ips='*' --access-logfile - --error-logfile -"]