-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
55 lines (40 loc) · 1.09 KB
/
Dockerfile
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
# Build stage for Frontend
FROM node:18-alpine AS frontend-builder
# Set working directory
WORKDIR /app/frontend
# Copy package files
COPY frontend/package*.json ./
# Install dependencies
RUN npm install
# Copy frontend source code
COPY frontend/ ./
# Build frontend
RUN npm run build
# Build stage for Backend
FROM python:3.12-slim AS backend
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
RUN python -m nltk.downloader all
# Copy backend source code
COPY src/ /app/src/
# Copy run script
COPY run.py .
# Copy built frontend files
COPY --from=frontend-builder /app/frontend/build /app/frontend/build
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app
# Create necessary directories
RUN mkdir -p /app/uploads
# Expose port
EXPOSE 8765
# Start the application using run.py
CMD ["python", "run.py"]