-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (32 loc) · 920 Bytes
/
Dockerfile
File metadata and controls
44 lines (32 loc) · 920 Bytes
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
# Stage 1: Build React frontend
FROM node:18 AS frontend-build
WORKDIR /app/frontend
# Copy package files
COPY package.json package-lock.json ./
RUN npm install
# Copy frontend source code
COPY public/ public/
COPY src/ src/
# Build React app
RUN npm run build
# Stage 2: Python backend with React static files
FROM python:3.11-slim
WORKDIR /app
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the Python backend
COPY chatbot.py .
COPY users.json .
COPY .env .
COPY templates/ templates/
COPY templates/static/* /app/static/
# Copy React build files from frontend stage
COPY --from=frontend-build /app/frontend/build/* /app/static/
# Expose the port the app runs on
EXPOSE 8000
# Environment variable for Flask
ENV FLASK_APP=chatbot.py
ENV FLASK_ENV=production
# Command to run the application
CMD ["python", "chatbot.py"]