-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (32 loc) · 981 Bytes
/
Copy pathDockerfile
File metadata and controls
42 lines (32 loc) · 981 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
# Use Python 3.11 slim image
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies and Node.js 20.x
RUN apt-get update && apt-get install -y \
curl \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g yarn \
&& rm -rf /var/lib/apt/lists/*
# Copy package files first for better caching
COPY package.json yarn.lock ./
COPY frontend/package.json frontend/yarn.lock ./frontend/
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Install Node.js dependencies (without --frozen-lockfile to allow updates)
RUN yarn install
RUN cd frontend && yarn install
# Copy application code
COPY . .
# Build the React frontend
RUN cd frontend && yarn build
# Expose port
EXPOSE 8080
# Set environment variables
ENV FLASK_APP=app.py
ENV FLASK_ENV=production
ENV PORT=8080
# Run the application
CMD ["python", "app.py"]