File size: 1,133 Bytes
b7b370e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5526594
b7b370e
 
5526594
 
b7b370e
5526594
 
 
 
b7b370e
5526594
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b7b370e
5526594
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
FROM node:18 AS build

# Set the working directory inside the container
WORKDIR /app

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy the rest of the application code
COPY . .

# Fix for OpenSSL issue
ENV NODE_OPTIONS=--openssl-legacy-provider

# Build the Angular project
RUN npm run build -- --output-path=dist/AiQA-Web --configuration production

# Step 2: Serve the Angular app with FastAPI
FROM python:3.9

# Set up a user for running the app
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

# Set working directory
WORKDIR /app

# Install FastAPI and Uvicorn
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy the built Angular app to the Python container
COPY --from=build /app/dist/AiQA-Web /app/frontend

# Copy the FastAPI server app
COPY --chown=user ./app.py /app

# Expose port 7860 for Hugging Face Spaces
EXPOSE 7860

# Start FastAPI server to serve Angular app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]