File size: 752 Bytes
424fc1b
 
 
 
 
 
 
 
 
 
b1e57e4
789a91e
 
 
 
 
 
 
 
 
 
 
 
 
424fc1b
 
 
 
 
789a91e
424fc1b
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
# Multi-stage build: First build React app
FROM node:18 as frontend-build

WORKDIR /frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ ./
RUN npm run build

# Use Python runtime for backend
FROM python:3.10

WORKDIR /code

COPY backend/requirements.txt /code/backend/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/backend/requirements.txt

RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user
ENV PATH=/home/user/.local/bin:$PATH

WORKDIR $HOME/app

# Copy backend
COPY --chown=user backend/ $HOME/app/backend/

# Copy built React app to frontend directory
COPY --from=frontend-build --chown=user /frontend/dist/ $HOME/app/frontend/

CMD ["uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "7860"]