Download Dockerfile from Hans-R-D/Nexus: direct link, hf CLI and curl.
- Browser
- Download file 993 Bytes
-
https://huggingface.co/spaces/Hans-R-D/Nexus/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Hans-R-D/Nexus/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Hans-R-D/Nexus/resolve/main/Dockerfile
993 Bytes
| # Stage 1: Build the Next.js application | |
| FROM node:20-alpine AS builder | |
| RUN apk add --no-cache libc6-compat | |
| WORKDIR /app | |
| # Install dependencies | |
| COPY frontend/package.json frontend/package-lock.json ./ | |
| RUN npm install | |
| # Copy source files and build the Next.js application | |
| COPY frontend ./ | |
| RUN npm run build | |
| # Install PM2 globally | |
| RUN npm install -g pm2 | |
| # Stage 2: Run the Next.js application with PM2 | |
| FROM node:20-alpine | |
| # Create necessary directories with write permissions | |
| WORKDIR /tmp | |
| RUN mkdir -p /tmp/app/.next/cache/images /tmp/app/.next/cache/fetch-cache | |
| # Copy the Next.js build and node_modules from the builder stage | |
| COPY --from=builder /app /tmp/app | |
| WORKDIR /tmp/app | |
| # Change ownership of the /tmp/app directory to the node user | |
| RUN chown -R node:node /tmp/app | |
| # Install PM2 globally | |
| RUN npm install -g pm2 | |
| # Set environment variables | |
| ENV PORT=7860 | |
| # Expose port 7860 | |
| EXPOSE 7860 | |
| # Run the application with PM2 | |
| USER node | |
| CMD ["pm2-runtime", "start", "npm", "--", "start"] |