Spaces:
Sleeping
Sleeping
File size: 1,958 Bytes
2c60697 | 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 | # ββββββββββββββββββββββββββββββββββββββββββββββ
# Stage 1 β Build Angular frontend
# ββββββββββββββββββββββββββββββββββββββββββββββ
FROM node:20-alpine AS frontend-build
WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci
COPY frontend/ ./
RUN npx ng build --configuration=production
# ββββββββββββββββββββββββββββββββββββββββββββββ
# Stage 2 β Production image (nginx + FastAPI)
# ββββββββββββββββββββββββββββββββββββββββββββββ
FROM python:3.12-slim
# Install nginx & supervisor
RUN apt-get update && \
apt-get install -y --no-install-recommends nginx supervisor && \
rm -rf /var/lib/apt/lists/*
# ββ Python backend βββββββββββββββββββββββββββ
WORKDIR /app
COPY backend/requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY backend/ ./backend/
# ββ Frontend static files ββββββββββββββββββββ
COPY --from=frontend-build /app/frontend/dist/frontend/browser /usr/share/nginx/html
# ββ Nginx config βββββββββββββββββββββββββββββ
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Remove default nginx site that might conflict
RUN rm -f /etc/nginx/sites-enabled/default
# ββ Supervisor config ββββββββββββββββββββββββ
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Hugging Face Spaces uses port 7860
EXPOSE 7860
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|