File size: 1,182 Bytes
962ece6
 
 
d761868
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
962ece6
 
d761868
962ece6
 
 
 
d761868
962ece6
 
d761868
 
 
 
962ece6
 
 
ee78a6b
 
d761868
 
 
 
 
962ece6
d761868
5f6a730
 
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
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile

# Use an official Node runtime as a parent image
FROM node:16 as node-builder

# Set the working directory in the container
WORKDIR /app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy the rest of the application code
COPY . .

# Build the React app
RUN npm run build

# Use an official Python runtime as a parent image
FROM python:3.9

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

# Set the working directory in the container
WORKDIR /app

# Copy the built React app from the node-builder stage
COPY --from=node-builder /app/build /app/build

# Copy requirements.txt and install Python dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy the rest of the application code
COPY --chown=user . /app

# Expose the port the app runs on
EXPOSE 7860

# Command to run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]