Spaces:
Sleeping
Sleeping
Changed path of dist folder file
Browse files- Dockerfile +30 -33
Dockerfile
CHANGED
@@ -1,47 +1,44 @@
|
|
1 |
-
#
|
2 |
-
FROM
|
3 |
|
4 |
-
# Set
|
5 |
-
WORKDIR /app
|
6 |
|
7 |
-
#
|
8 |
-
|
9 |
-
|
10 |
-
&& rm -rf /var/lib/apt/lists/*
|
11 |
|
12 |
-
#
|
13 |
-
|
14 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
15 |
|
16 |
-
#
|
17 |
-
|
18 |
|
19 |
-
#
|
20 |
-
|
21 |
|
22 |
-
#
|
23 |
-
|
24 |
|
25 |
-
#
|
26 |
-
|
27 |
|
28 |
-
#
|
29 |
-
COPY
|
|
|
30 |
|
31 |
-
#
|
32 |
-
|
33 |
-
RUN npm run build
|
34 |
|
35 |
-
#
|
36 |
-
|
37 |
|
38 |
-
# Copy built
|
39 |
-
COPY --from=
|
40 |
|
41 |
-
#
|
42 |
-
|
43 |
-
# COPY nginx.conf /etc/nginx/nginx.conf
|
44 |
|
45 |
-
# Start
|
46 |
-
CMD ["
|
47 |
|
|
|
1 |
+
# Stage 1: Build frontend
|
2 |
+
FROM node:latest AS frontend
|
3 |
|
4 |
+
# Set working directory for frontend
|
5 |
+
WORKDIR /app/frontend
|
6 |
|
7 |
+
# Copy frontend source code
|
8 |
+
COPY frontend/package.json frontend/package-lock.json ./
|
9 |
+
COPY frontend .
|
|
|
10 |
|
11 |
+
# Install dependencies
|
12 |
+
RUN npm install
|
|
|
13 |
|
14 |
+
# Build frontend
|
15 |
+
RUN npm run build
|
16 |
|
17 |
+
# Stage 2: Build backend
|
18 |
+
FROM python:3.9-slim AS backend
|
19 |
|
20 |
+
# Set working directory for backend
|
21 |
+
WORKDIR /app/backend
|
22 |
|
23 |
+
# Copy backend source code
|
24 |
+
COPY backend .
|
25 |
|
26 |
+
# Install backend dependencies
|
27 |
+
COPY requirements.txt .
|
28 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
29 |
|
30 |
+
# Stage 3: Serve frontend and backend using nginx and gunicorn
|
31 |
+
FROM nginx:latest AS production
|
|
|
32 |
|
33 |
+
# Copy built frontend files from the frontend stage to nginx
|
34 |
+
COPY --from=frontend /app/frontend/dist /usr/share/nginx/html
|
35 |
|
36 |
+
# Copy built backend code from the backend stage
|
37 |
+
COPY --from=backend /app/backend /app/backend
|
38 |
|
39 |
+
# Expose port 80 for nginx
|
40 |
+
EXPOSE 80
|
|
|
41 |
|
42 |
+
# Start gunicorn server for backend
|
43 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "app:app"]
|
44 |
|