newnew_AI / Dockerfile
SarahXia0405's picture
Update Dockerfile
f20c3be verified
Raw
History Blame Contribute Delete
1.11 kB
FROM python:3.10-slim
WORKDIR /app
# System deps
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
ca-certificates \
gnupg \
&& rm -rf /var/lib/apt/lists/*
# ---------- Backend deps ----------
COPY newnew_AI/backend/requirements.txt /app/backend/requirements.txt
RUN pip install --no-cache-dir -r /app/backend/requirements.txt
# ---------- Copy project ----------
COPY newnew_AI/backend /app/backend
COPY newnew_AI/frontend /app/frontend
# ---------- Build frontend ----------
WORKDIR /app/frontend
RUN test -f package.json || (echo "ERROR: /app/frontend/package.json not found" && ls -la && exit 1)
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get update && apt-get install -y nodejs \
&& node -v && npm -v \
&& if [ -f package-lock.json ]; then npm ci --no-audit --no-fund; else npm install --no-audit --no-fund; fi \
&& npm run build \
&& rm -rf /var/lib/apt/lists/*
# ---------- Run API ----------
WORKDIR /app
ENV PORT=7860
EXPOSE 7860
CMD ["uvicorn", "backend.api:app", "--host", "0.0.0.0", "--port", "7860"]