Spaces:
Sleeping
Sleeping
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"] | |