LogicGoInfotechSpaces commited on
Commit
d83afc4
·
verified ·
1 Parent(s): 2af9d3b

Update dockerfile

Browse files
Files changed (1) hide show
  1. dockerfile +16 -18
dockerfile CHANGED
@@ -1,35 +1,33 @@
1
  # -------------------------------------------------------------
2
- # Base Image
3
  # -------------------------------------------------------------
4
- FROM node:18-slim AS build
5
 
6
- WORKDIR /app
7
 
8
- # Copy package files first (cache-friendly)
9
- COPY package.json package-lock.json* ./
 
10
 
11
- # Install dependencies
12
- RUN npm install --production
13
 
14
- # Copy source code
15
- COPY . .
16
 
17
  # -------------------------------------------------------------
18
- # Final Image Stage
19
  # -------------------------------------------------------------
20
- FROM node:18-slim
21
 
22
- ENV NODE_ENV=production
23
- ENV PORT=7860
24
  ENV PYTHONUNBUFFERED=1
 
25
 
26
  WORKDIR /app
27
 
28
- # Copy only installed node_modules + code
29
- COPY --from=build /app /app
 
30
 
31
- # HuggingFace Spaces requires port 7860
32
  EXPOSE 7860
33
 
34
- # Start server
35
- CMD ["node", "index.js"]
 
1
  # -------------------------------------------------------------
2
+ # Build Stage
3
  # -------------------------------------------------------------
4
+ FROM python:3.10-slim AS build
5
 
6
+ ENV PYTHONUNBUFFERED=1
7
 
8
+ RUN apt-get update && apt-get install -y --no-install-recommends \
9
+ build-essential \
10
+ && rm -rf /var/lib/apt/lists/*
11
 
12
+ WORKDIR /app
 
13
 
14
+ COPY requirements.txt .
15
+ RUN pip install --no-cache-dir -r requirements.txt
16
 
17
  # -------------------------------------------------------------
18
+ # Final Runtime Stage
19
  # -------------------------------------------------------------
20
+ FROM python:3.10-slim
21
 
 
 
22
  ENV PYTHONUNBUFFERED=1
23
+ ENV PORT=7860
24
 
25
  WORKDIR /app
26
 
27
+ COPY --from=build /usr/local /usr/local
28
+ COPY main.py .
29
+ COPY requirements.txt .
30
 
 
31
  EXPOSE 7860
32
 
33
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]