-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
63 lines (52 loc) · 1.7 KB
/
Copy pathDockerfile
File metadata and controls
63 lines (52 loc) · 1.7 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
59
60
61
62
63
# Multi-stage Dockerfile for LLMployable
# Stage 1: Frontend Builder
FROM node:20-slim as frontend-builder
WORKDIR /frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ ./
# Set API URL to empty string so it uses relative paths in production
ENV VITE_API_URL=""
RUN npm run build
# Stage 2: Python Builder
FROM python:3.11-slim as python-builder
WORKDIR /build
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --user --no-cache-dir -r requirements.txt
# Stage 3: Runtime
FROM python:3.11-slim
WORKDIR /app
# Install runtime dependencies (LaTeX, etc.)
RUN apt-get update && apt-get install -y --no-install-recommends \
texlive-latex-base \
texlive-latex-extra \
texlive-fonts-recommended \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy Python packages from builder
COPY --from=python-builder /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
# Copy frontend build to a directory Flask can serve
RUN mkdir -p static
COPY --from=frontend-builder /frontend/dist ./static
# Copy application code
COPY . .
# Create required directories
RUN mkdir -p logs uploads temp && \
chmod -R 755 logs uploads temp
# Expose port (Render will use this)
EXPOSE 5000
# Default environment
ENV ENVIRONMENT=production \
HOST=0.0.0.0 \
PORT=5000 \
STATIC_FOLDER=static
# Run with gunicorn
CMD ["sh", "-c", "gunicorn --bind 0.0.0.0:${PORT:-5000} --workers 2 --threads 4 --worker-class gthread --timeout 300 --access-logfile - --error-logfile - --log-level info 'app_production:create_app()'"]