-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (43 loc) · 1.43 KB
/
Dockerfile
File metadata and controls
54 lines (43 loc) · 1.43 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
# Use Python 3.11 slim image as base
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies required for PDF processing
RUN apt-get update && apt-get install -y \
bash \
# Required for PyMuPDF
libmupdf-dev \
mupdf-tools \
# Required for ReportLab and image processing
libjpeg-dev \
zlib1g-dev \
libfreetype6-dev \
liblcms2-dev \
libopenjp2-7-dev \
libtiff5-dev \
build-essential \
# Clean up
&& rm -rf /var/lib/apt/lists/*
# Add Ghostscript for font embedding
RUN apt-get update && apt-get install -y ghostscript && 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 directories for uploads, outputs, and storage
RUN mkdir -p /app/uploads /app/outputs /app/temp /app/pdf_storage/original /app/pdf_storage/processed
# Expose port (use 8080 for DO App Platform compatibility)
EXPOSE 8080
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PIP_NO_CACHE_DIR=1
# Use Gunicorn entrypoint by default (production/staging)
# Dev compose overrides this with --reload.
COPY scripts/start.sh /app/scripts/start.sh
COPY gunicorn_conf.py /app/gunicorn_conf.py
RUN chmod +x /app/scripts/start.sh
CMD ["/app/scripts/start.sh"]