Spaces:
Sleeping
Sleeping
| # Stage 1: Build the Nuxt frontend natively inside the container | |
| FROM node:20-slim AS builder | |
| WORKDIR /build | |
| # Copy only frontend requirements to leverage Docker cache | |
| COPY frontend/package*.json ./ | |
| RUN npm install | |
| # Copy frontend source files and compile | |
| COPY frontend/ ./ | |
| RUN npm run build | |
| # Stage 2: Final runtime image | |
| FROM ldsprgrm/algovision-deps:latest | |
| # Install Node.js and Git | |
| RUN apt-get update && apt-get install -y curl git && \ | |
| curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ | |
| apt-get install -y nodejs && \ | |
| rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Copy the natively built frontend output to the runtime stage | |
| COPY --from=builder /build/.output /app/frontend-server | |
| # Copy the bootloader script | |
| COPY bootloader.sh . | |
| RUN chmod +x bootloader.sh | |
| # Set environment variables for ports and execution | |
| ENV PYTHONPATH=/app | |
| ENV PORT=7860 | |
| ENV NUXT_PORT=7860 | |
| ENV NUXT_HOST=0.0.0.0 | |
| EXPOSE 7860 | |
| # Run bootloader | |
| ENTRYPOINT ["./bootloader.sh"] | |