skill-tree-tracker / Dockerfile
duqing2026's picture
修复 dockerfile 构建错误
88f8b60
Raw
History Blame Contribute Delete
865 Bytes
# Stage 1: Build Frontend
FROM node:20-slim AS frontend-builder
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ ./
RUN npm run build
# Stage 2: Backend Setup
FROM python:3.9-slim
WORKDIR /app
# Install system dependencies if needed
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy backend requirements
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy backend code
COPY app.py .
# Create data directory and set permissions (crucial for HF Spaces)
RUN mkdir -p /app/data && chmod 777 /app/data
# Copy built frontend from Stage 1
COPY --from=frontend-builder /app/frontend/dist ./frontend/dist
# Environment variables
ENV PYTHONUNBUFFERED=1
ENV PORT=7860
# Expose port
EXPOSE 7860
# Run command
CMD ["python", "app.py"]