-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (42 loc) · 1.28 KB
/
Copy pathDockerfile
File metadata and controls
60 lines (42 loc) · 1.28 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.11-slim
# Set metadata
LABEL maintainer="Devsidd2006"
LABEL description="Intelligent Query PDF Q&A System - AI-powered document analysis"
LABEL version="1.0.0"
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
g++ \
build-essential \
curl \
wget \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# 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 and scripts
COPY src/ ./src/
COPY run_flask.py .
# Create uploads directory with proper permissions
RUN mkdir -p uploads && \
mkdir -p logs && \
chmod 755 uploads logs
# Set environment variables with proper Python path
ENV PYTHONPATH="/app/src:/app"
ENV PYTHONUNBUFFERED=1
# Create non-root user for security
RUN useradd --create-home --shell /bin/bash appuser && \
chown -R appuser:appuser /app
USER appuser
# Expose Flask port
EXPOSE 3000
# Health check for Flask
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:3000/status || exit 1
# Start Flask web server
CMD ["python", "run_flask.py"]