CoolFace
Apppublic

yuuuuc/deepseek-coder-v2

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
Dockerfile.back74 linesDownload Raw Back to root
1# Multi-stage build for Vue 3 frontend2FROM node:20-slim AS frontend-builder3 4WORKDIR /app5 6# Copy package files and npm config for better layer caching7COPY package.json .npmrc ./8COPY scripts/ ./scripts/9 10# Workaround for npm optionalDependencies bug (https://github.com/npm/cli/issues/4828)11# Don't copy package-lock.json and use fresh install with explicit platform detection12RUN rm -f package-lock.json && \13    npm install --silent && \14    npm install @rollup/rollup-linux-x64-musl --no-save --silent || \15    npm install @rollup/rollup-linux-x64-gnu --no-save --silent || \16    echo "Warning: Could not install platform-specific rollup"17 18# Copy source code and build frontend19COPY index.html vite.config.ts tsconfig.json env.d.ts ./20COPY src/ ./src/21 22# Build frontend (prebuild script will handle platform-specific rollup if needed)23RUN npm run build24 25# Python backend stage26FROM python:3.11-slim27 28# Create user for security (required by Hugging Face Spaces)29RUN useradd -m -u 1000 user30 31# Install system dependencies as root and clean up in single layer32RUN apt-get update && apt-get install -y --no-install-recommends \33    curl \34    ca-certificates \35    && rm -rf /var/lib/apt/lists/* \36    && apt-get clean37 38# Switch to user39USER user40ENV PATH="/home/user/.local/bin:$PATH"41 42WORKDIR /app43 44# Copy requirements first for better Docker layer caching45COPY --chown=user ./requirements.txt requirements.txt46 47# Install Python dependencies with optimizations48RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \49    pip install --no-cache-dir -r requirements.txt50 51# Copy Python application code52COPY --chown=user app.py ./53 54# Copy built frontend from builder stage55COPY --from=frontend-builder --chown=user /app/dist ./static56 57# Create logs directory58RUN mkdir -p /app/logs59 60# Set environment variables for Python optimization61ENV PYTHONUNBUFFERED=1 \62    PYTHONDONTWRITEBYTECODE=1 \63    PYTHONHASHSEED=random \64    PIP_NO_CACHE_DIR=1 \65    PIP_DISABLE_PIP_VERSION_CHECK=166 67# Expose the port that Hugging Face Spaces expects68EXPOSE 786069 70# Hugging Face Spaces handles health checks internally71# Removed Docker HEALTHCHECK to avoid conflicts72 73# Start the application74CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]