Spaces:
Runtime error
Runtime error
Sandra Ashipala
commited on
Commit
·
85b09a4
1
Parent(s):
963f5c7
Updated Dockerfile
Browse files- .Dockerfile.swp +0 -0
- Dockerfile +32 -12
.Dockerfile.swp
DELETED
|
Binary file (12.3 kB)
|
|
|
Dockerfile
CHANGED
|
@@ -1,4 +1,25 @@
|
|
| 1 |
-
# Use
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
FROM node:14 AS frontend
|
| 3 |
|
| 4 |
# Set the working directory for the frontend in the container
|
|
@@ -7,21 +28,20 @@ WORKDIR /app/frontend
|
|
| 7 |
# Copy frontend source code
|
| 8 |
COPY frontend /app/frontend
|
| 9 |
|
| 10 |
-
# Install frontend dependencies
|
| 11 |
RUN npm install
|
| 12 |
-
|
| 13 |
-
# Build the frontend for production
|
| 14 |
RUN npm run build
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
FROM
|
| 18 |
|
| 19 |
-
# Copy
|
| 20 |
-
COPY --from=frontend /app/frontend/
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
-
# Start
|
| 26 |
-
CMD ["
|
| 27 |
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.9-slim AS backend
|
| 3 |
+
|
| 4 |
+
# Set the working directory for the backend in the container
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install system dependencies
|
| 8 |
+
RUN apt-get update \
|
| 9 |
+
&& apt-get install -y --no-install-recommends gcc \
|
| 10 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
+
|
| 12 |
+
# Copy backend application dependencies
|
| 13 |
+
COPY requirements.txt /app/
|
| 14 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
+
|
| 16 |
+
# Copy all backend source code from the root directory
|
| 17 |
+
COPY . /app/
|
| 18 |
+
|
| 19 |
+
# Expose the port the backend app runs on
|
| 20 |
+
EXPOSE 5000
|
| 21 |
+
|
| 22 |
+
# Build frontend
|
| 23 |
FROM node:14 AS frontend
|
| 24 |
|
| 25 |
# Set the working directory for the frontend in the container
|
|
|
|
| 28 |
# Copy frontend source code
|
| 29 |
COPY frontend /app/frontend
|
| 30 |
|
| 31 |
+
# Install frontend dependencies and build
|
| 32 |
RUN npm install
|
|
|
|
|
|
|
| 33 |
RUN npm run build
|
| 34 |
|
| 35 |
+
# Merge frontend build with backend
|
| 36 |
+
FROM backend AS final
|
| 37 |
|
| 38 |
+
# Copy built frontend files to appropriate location for serving
|
| 39 |
+
COPY --from=frontend /app/frontend/dist /app/frontend/dist
|
| 40 |
|
| 41 |
+
# Add configuration to serve frontend files using Nginx
|
| 42 |
+
# Example:
|
| 43 |
+
# COPY nginx.conf /etc/nginx/nginx.conf
|
| 44 |
|
| 45 |
+
# Start the backend server
|
| 46 |
+
CMD ["python", "together_call.py"]
|
| 47 |
|