Intel_classification / Dockerfile
danielle2035's picture
Fix: Correct Dockerfile syntax for RUN instructions
fbe61df
Raw
History Blame Contribute Delete
2.7 kB
# ============================================================================
# UNIFIED DOCKERFILE FOR HUGGING FACE DEPLOYMENT
# Intel Image Classifier - Django Backend + React Frontend + ML Models
# ============================================================================
FROM python:3.12-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PATH=/app/node_modules/.bin:$PATH \
NODE_ENV=production \
DEBUG=False
WORKDIR /app
# ============================================================================
# SYSTEM DEPENDENCIES
# ============================================================================
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
gnupg \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y --no-install-recommends \
nodejs \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# ============================================================================
# PYTHON DEPENDENCIES
# ============================================================================
COPY backend/requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# ============================================================================
# PROJECT FILES
# ============================================================================
COPY . .
# ============================================================================
# BUILD FRONTEND (React)
# ============================================================================
WORKDIR /app/frontend
RUN npm install --omit=dev
RUN npm run build
# ============================================================================
# PREPARE BACKEND
# ============================================================================
WORKDIR /app/backend/api
# Create necessary directories for Django
RUN mkdir -p static media logs
# Collect static files during build (not runtime)
RUN python manage.py collectstatic --noinput --clear || echo "Warning: Static files collection failed during build"
# Copy frontend build to Django static directory during build
RUN mkdir -p static/frontend && \
cp -r /app/frontend/build/* static/frontend/ 2>/dev/null || echo "Warning: Frontend build copy failed during build"
# Make entrypoint executable
RUN chmod +x /app/backend/api/entrypoint.sh
# ============================================================================
# EXPOSE & RUN
# ============================================================================
EXPOSE 7860
# Use entrypoint script for proper initialization
ENTRYPOINT ["/app/backend/api/entrypoint.sh"]