# Stage 1: Build frontend FROM node:18-alpine AS frontend-build WORKDIR /build COPY frontend/package*.json ./frontend/ COPY frontend/ ./ RUN npm ci RUN npm run build # Stage 2: Build backend FROM python:3.11-slim AS backend-build RUN useradd -m -u 1000 user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR /home/user/app RUN apt-get update && apt-get install -y gcc && rm -rf /var/lib/apt/lists/* COPY backend/requirements.txt /tmp/requirements.txt RUN pip install --no-cache-dir -r /tmp/requirements.txt COPY backend/ /home/user/app COPY --from=frontend-build /build/dist /home/user/app/frontend_dist RUN mkdir -p /data && chmod 700 /data USER user RUN pip install --no-cache-dir --upgrade pip # Stage 3: Final image with nginx and supervisord FROM python:3.11-slim RUN apt-get update && apt-get install -y nginx supervisor gcc && rm -rf /var/lib/apt/lists/* RUN useradd -m -u 1000 user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR /home/user/app COPY --from=backend-build /home/user/app /home/user/app COPY --from=backend-build /data /data COPY nginx.conf /etc/nginx/nginx.conf COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf RUN mkdir -p /data && chmod 700 /data USER user EXPOSE 7860 ## ENTRYPOINT removed: entrypoint.sh does not exist CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]