Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +24 -11
Dockerfile
CHANGED
@@ -1,5 +1,3 @@
|
|
1 |
-
# Step 1: Build the Angular app
|
2 |
-
# Use a Node.js image to build the Angular project
|
3 |
FROM node:18 AS build
|
4 |
|
5 |
# Set the working directory inside the container
|
@@ -17,17 +15,32 @@ COPY . .
|
|
17 |
# Fix for OpenSSL issue
|
18 |
ENV NODE_OPTIONS=--openssl-legacy-provider
|
19 |
|
20 |
-
# Build the Angular project
|
21 |
RUN npm run build -- --output-path=dist/AiQA-Web --configuration production
|
22 |
|
23 |
-
# Step 2: Serve the Angular app with
|
24 |
-
FROM
|
25 |
|
26 |
-
#
|
27 |
-
|
|
|
|
|
28 |
|
29 |
-
#
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
-
# Start
|
33 |
-
CMD ["
|
|
|
|
|
|
|
1 |
FROM node:18 AS build
|
2 |
|
3 |
# Set the working directory inside the container
|
|
|
15 |
# Fix for OpenSSL issue
|
16 |
ENV NODE_OPTIONS=--openssl-legacy-provider
|
17 |
|
18 |
+
# Build the Angular project
|
19 |
RUN npm run build -- --output-path=dist/AiQA-Web --configuration production
|
20 |
|
21 |
+
# Step 2: Serve the Angular app with FastAPI
|
22 |
+
FROM python:3.9
|
23 |
|
24 |
+
# Set up a user for running the app
|
25 |
+
RUN useradd -m -u 1000 user
|
26 |
+
USER user
|
27 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
28 |
|
29 |
+
# Set working directory
|
30 |
+
WORKDIR /app
|
31 |
+
|
32 |
+
# Install FastAPI and Uvicorn
|
33 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
34 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
35 |
+
|
36 |
+
# Copy the built Angular app to the Python container
|
37 |
+
COPY --from=build /app/dist/AiQA-Web /app/frontend
|
38 |
+
|
39 |
+
# Copy the FastAPI server app
|
40 |
+
COPY --chown=user ./app.py /app
|
41 |
+
|
42 |
+
# Expose port 7860 for Hugging Face Spaces
|
43 |
+
EXPOSE 7860
|
44 |
|
45 |
+
# Start FastAPI server to serve Angular app
|
46 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|