chipling commited on
Commit
88cbdba
·
verified ·
1 Parent(s): d6fb459

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -4
Dockerfile CHANGED
@@ -1,16 +1,33 @@
1
- # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
- # you will also find guides on how best to write your Dockerfile
3
-
4
  FROM python:3.9
5
 
 
 
 
 
 
 
6
  RUN useradd -m -u 1000 user
7
  USER user
8
  ENV PATH="/home/user/.local/bin:$PATH"
9
-
10
  WORKDIR /app
11
 
 
12
  COPY --chown=user ./requirements.txt requirements.txt
13
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
14
 
 
 
 
 
 
 
 
 
15
  COPY --chown=user . /app
 
 
 
 
 
16
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker# you will also find guides on how best to write your Dockerfile
 
 
2
  FROM python:3.9
3
 
4
+ # Install Node.js and npm
5
+ # Using NodeSource's official script for stable Node.js installation
6
+ RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
7
+ && apt-get install -y nodejs
8
+
9
+ # Create a non-root user and set up environment
10
  RUN useradd -m -u 1000 user
11
  USER user
12
  ENV PATH="/home/user/.local/bin:$PATH"
 
13
  WORKDIR /app
14
 
15
+ # Copy Python requirements and install them
16
  COPY --chown=user ./requirements.txt requirements.txt
17
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
18
 
19
+ # Copy Node.js package files and install dependencies
20
+ # Ensure package.json and package-lock.json (if exists) are in the same directory as Dockerfile
21
+ COPY --chown=user ./package.json package.json
22
+ # If you have a package-lock.json, uncomment the line below:
23
+ # COPY --chown=user ./package-lock.json package-lock.json
24
+ RUN npm install
25
+
26
+ # Copy the rest of the application files
27
  COPY --chown=user . /app
28
+
29
+ # Expose the port FastAPI will listen on
30
+ EXPOSE 7860
31
+
32
+ # Command to run the FastAPI application
33
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]