Spaces:
Running
Running
File size: 873 Bytes
e21e66e 3cb2ade e21e66e 3cb2ade e21e66e 3cb2ade e21e66e f317ff7 3cb2ade e21e66e 7aafcd0 e21e66e 3cb2ade f317ff7 9bc6413 3cb2ade bea7063 |
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 48 |
# Multi-stage build: Build frontend first
FROM node:18-bullseye AS frontend-build
# Create app directory
WORKDIR /app
# Copy frontend files
COPY frontend/package*.json ./
RUN npm install
# Copy frontend source
COPY frontend/ ./
# Build the frontend
RUN npm run build
# Backend build
FROM node:18-bullseye AS backend-build
WORKDIR /app
COPY backend/package*.json ./
RUN npm install
COPY backend/ ./
# Final stage
FROM node:18-bullseye
# Install serve globally to serve frontend
RUN npm install -g serve
# Create app directory
WORKDIR /app
# Copy built frontend from frontend-build stage
COPY --from=frontend-build /app/dist ./frontend/dist
# Setup backend
COPY --from=backend-build /app ./backend
# Copy startup script
COPY start.sh .
RUN chmod +x start.sh
# Expose the port that Hugging Face Spaces expects
EXPOSE 8501
# Start both services
CMD ["./start.sh"] |