File size: 924 Bytes
1a618da
 
 
c2ff64d
1a618da
5757092
 
 
 
 
1a618da
 
 
 
3451992
1a618da
 
9bdefe0
ebb6c1b
9bdefe0
 
 
ebb6c1b
 
9bdefe0
 
 
 
 
 
 
 
 
 
1a618da
 
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
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile

FROM python:3.12-slim

# Install system deps as root
USER root
# Install system dependencies including Node.js and npm
RUN apt-get update && apt-get install -y nodejs npm && rm -rf /var/lib/apt/lists/*

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

# Create app dir
WORKDIR /app

# Copy backend requirements
COPY --chown=user backend/requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt

# Copy backend and frontend
COPY --chown=user backend/ /app/backend/
COPY --chown=user frontend/ /app/frontend/

# Build frontend
WORKDIR /app/frontend
RUN npm install && npm run build

# Back to backend
WORKDIR /app/backend

# Expose port
EXPOSE 7860

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