portfolio-assistant / Dockerfile
Saivineeth147
Update Dockerfile for HuggingFace Spaces
1278663
Raw
History Blame Contribute Delete
852 Bytes
# Stage 1: Build frontend
FROM node:20-alpine AS frontend-builder
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ ./
RUN npm run build
# Stage 2: Python runtime
FROM python:3.11-slim
# Set up user for HuggingFace
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Copy requirements first for caching
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Copy backend
COPY --chown=user backend/ ./backend/
# Copy frontend build from stage 1
COPY --from=frontend-builder --chown=user /app/frontend/dist ./frontend/dist
# Environment
ENV PORT=7860
EXPOSE 7860
# Run server
CMD ["python", "-m", "uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]