Avinashnalla7 commited on
Commit
05ab5ed
·
1 Parent(s): 591cb7e

fix: API docker runtime (fastapi+uvicorn)

Browse files
Files changed (3) hide show
  1. Dockerfile +5 -22
  2. README.md +1 -1
  3. app.py +1 -2
Dockerfile CHANGED
@@ -1,25 +1,8 @@
1
- # ---- Build stage ----
2
- FROM node:20-alpine AS build
3
 
4
  WORKDIR /app
 
 
5
 
6
- COPY package.json package-lock.json ./
7
- RUN npm ci
8
-
9
- COPY . .
10
- RUN npm run build
11
-
12
- # ---- Runtime stage ----
13
- FROM nginx:alpine
14
-
15
- # Remove default nginx config
16
- RUN rm /etc/nginx/conf.d/default.conf
17
-
18
- # Custom nginx config
19
- COPY nginx.conf /etc/nginx/conf.d/default.conf
20
-
21
- # Copy built assets
22
- COPY --from=build /app/dist /usr/share/nginx/html
23
-
24
- EXPOSE 7860
25
- CMD ["nginx", "-g", "daemon off;"]
 
1
+ FROM python:3.11-slim
 
2
 
3
  WORKDIR /app
4
+ COPY requirements.txt /app/requirements.txt
5
+ RUN pip install --no-cache-dir -r /app/requirements.txt
6
 
7
+ COPY . /app
8
+ CMD ["python", "-u", "app.py"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README.md CHANGED
@@ -8,4 +8,4 @@ app_file: app.py
8
  pinned: false
9
  ---
10
 
11
- PDF Trainer API (Docker).
 
8
  pinned: false
9
  ---
10
 
11
+ PDF Trainer API.
app.py CHANGED
@@ -2,6 +2,5 @@ import os
2
  import uvicorn
3
 
4
  if __name__ == "__main__":
5
- host = "0.0.0.0"
6
  port = int(os.environ.get("PORT", "7860"))
7
- uvicorn.run("backend.api:app", host=host, port=port)
 
2
  import uvicorn
3
 
4
  if __name__ == "__main__":
 
5
  port = int(os.environ.get("PORT", "7860"))
6
+ uvicorn.run("backend.api:app", host="0.0.0.0", port=port)