File size: 1,200 Bytes
88cbdba
9ff4ef1
 
88cbdba
 
 
 
 
 
9ff4ef1
 
 
 
 
88cbdba
9ff4ef1
 
 
88cbdba
 
 
 
 
 
 
 
9ff4ef1
88cbdba
 
 
 
 
9ff4ef1
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
# 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.9

# Install Node.js and npm
# Using NodeSource's official script for stable Node.js installation
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
    && apt-get install -y nodejs

# Create a non-root user and set up environment
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app

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

# Copy Node.js package files and install dependencies
# Ensure package.json and package-lock.json (if exists) are in the same directory as Dockerfile
COPY --chown=user ./package.json package.json
# If you have a package-lock.json, uncomment the line below:
# COPY --chown=user ./package-lock.json package-lock.json
RUN npm install

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

# Expose the port FastAPI will listen on
EXPOSE 7860

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