munals commited on
Commit
7152f67
·
verified ·
1 Parent(s): 9c69d05

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -0
Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:18-slim AS frontend-build
2
+ WORKDIR /app/frontend
3
+ COPY frontend/package*.json ./
4
+ RUN npm ci
5
+ COPY frontend/ ./
6
+ ENV VITE_API_BASE_URL=/api
7
+ RUN npm run build
8
+
9
+ FROM python:3.10-slim
10
+
11
+ RUN apt-get update && apt-get install -y --no-install-recommends \
12
+ libgl1 libglib2.0-0 nginx \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ WORKDIR /code
16
+
17
+ COPY backend/requirements.txt /code/requirements.txt
18
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
19
+
20
+ COPY backend/ /code/backend/
21
+ COPY --from=frontend-build /app/frontend/dist /code/frontend/dist
22
+
23
+ RUN echo 'server { \
24
+ listen 7860; \
25
+ location /api/ { proxy_pass http://127.0.0.1:8000/; } \
26
+ location / { root /code/frontend/dist; try_files $uri $uri/ /index.html; } \
27
+ }' > /etc/nginx/sites-enabled/default
28
+
29
+ RUN echo '#!/bin/bash\n\
30
+ nginx & \n\
31
+ cd /code/backend && uvicorn api:app --host 127.0.0.1 --port 8000\n\
32
+ ' > /code/start.sh && chmod +x /code/start.sh
33
+
34
+ EXPOSE 7860
35
+
36
+ CMD ["/code/start.sh"]