design final
This commit is contained in:
parent
a0d2188f6f
commit
99a690972e
1414 changed files with 2389 additions and 1455 deletions
24
Dockerfile
24
Dockerfile
|
|
@ -8,29 +8,35 @@ ENV PYTHONUNBUFFERED=1
|
|||
# --- Set working directory ---
|
||||
WORKDIR /cost-assistant
|
||||
|
||||
# --- Install system dependencies (minimal for OpenCV, Poppler, PDF/image handling) ---
|
||||
# --- Install system dependencies (cached until packages change) ---
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libgl1 \
|
||||
libglib2.0-0 \
|
||||
poppler-utils \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# --- Copy requirements and install Python dependencies ---
|
||||
# --- Install Python dependencies (cached until requirements.txt changes) ---
|
||||
COPY requirements.txt .
|
||||
RUN python -m pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# --- Copy project files ---
|
||||
COPY . .
|
||||
# --- Create user early (cached, rarely changes) ---
|
||||
RUN groupadd -r appuser && useradd -r -g appuser appuser
|
||||
|
||||
# --- Create upload folder and set permissions ---
|
||||
RUN mkdir -p data/uploads \
|
||||
&& groupadd -r appuser && useradd -r -g appuser appuser \
|
||||
&& chown -R appuser:appuser data/uploads
|
||||
# --- Copy only necessary application files ---
|
||||
COPY --chown=appuser:appuser main.py .
|
||||
COPY --chown=appuser:appuser cost_calculator.py .
|
||||
COPY --chown=appuser:appuser mailer.py .
|
||||
COPY --chown=appuser:appuser templates/ ./templates/
|
||||
COPY --chown=appuser:appuser static/ ./static/
|
||||
|
||||
# --- Create upload folder ---
|
||||
RUN mkdir -p data/uploads && chown -R appuser:appuser data/uploads
|
||||
|
||||
# --- Switch to non-root user for security ---
|
||||
USER appuser
|
||||
|
||||
# --- Expose internal port (optional, handled via Docker Compose) ---
|
||||
# --- Expose internal port ---
|
||||
EXPOSE 8000
|
||||
|
||||
# --- Run Gunicorn with Uvicorn worker for production ---
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue