Spaces:
Sleeping
Sleeping
| FROM node:22-slim AS frontend-deps | |
| WORKDIR /app/frontend | |
| COPY frontend/package.json frontend/package-lock.json ./ | |
| RUN npm ci | |
| FROM node:22-slim AS frontend-build | |
| WORKDIR /app/frontend | |
| COPY --from=frontend-deps /app/frontend/node_modules ./node_modules | |
| COPY frontend ./ | |
| RUN npm run build | |
| FROM node:22-slim AS runtime | |
| RUN apt-get update \ | |
| && apt-get install -y --no-install-recommends nginx python3 python3-venv \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /home/node/app | |
| COPY requirements-studio.txt ./requirements-studio.txt | |
| RUN python3 -m venv /opt/venv \ | |
| && /opt/venv/bin/pip install --no-cache-dir -r requirements-studio.txt | |
| COPY --chown=node:node data_studio ./data_studio | |
| COPY --chown=node:node tokenizer ./tokenizer | |
| COPY --chown=node:node deploy/nginx.conf /etc/nginx/nginx.conf | |
| COPY --chown=node:node deploy/start.sh ./start.sh | |
| COPY --from=frontend-build --chown=node:node /app/frontend/.next/standalone ./frontend | |
| COPY --from=frontend-build --chown=node:node /app/frontend/.next/static ./frontend/.next/static | |
| RUN chmod +x ./start.sh \ | |
| && mkdir -p /var/lib/nginx /var/log/nginx /run \ | |
| && chown -R node:node /var/lib/nginx /var/log/nginx /run /etc/nginx | |
| USER node | |
| ENV HOME=/home/node | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PATH=/opt/venv/bin:$PATH | |
| ENV HOSTNAME=0.0.0.0 | |
| ENV PORT=3000 | |
| ENV STUDIO_ENV=production | |
| ENV ALLOW_LEGACY_IMPORT_EXPORT=false | |
| EXPOSE 7860 | |
| CMD ["./start.sh"] | |