Download web/Dockerfile from MogensR/VideoBackgroundReplacer: direct link, hf CLI and curl.
- Browser
- Download file 1.27 kB
-
https://huggingface.co/spaces/MogensR/VideoBackgroundReplacer/resolve/main/web/Dockerfile
- Command line
-
hf download hf://spaces/MogensR/VideoBackgroundReplacer/web/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/MogensR/VideoBackgroundReplacer/resolve/main/web/Dockerfile
1.27 kB
| # Multi-stage build for Next.js application | |
| # Stage 1: Dependencies | |
| FROM node:20-alpine AS deps | |
| RUN apk add --no-cache libc6-compat | |
| WORKDIR /app | |
| # Copy package files | |
| COPY package.json package-lock.json* ./ | |
| RUN npm ci | |
| # Stage 2: Builder | |
| FROM node:20-alpine AS builder | |
| WORKDIR /app | |
| # Copy dependencies from deps stage | |
| COPY --from=deps /app/node_modules ./node_modules | |
| COPY . . | |
| # Build arguments for environment variables | |
| ARG NEXT_PUBLIC_API_URL | |
| ARG NEXT_PUBLIC_APP_URL | |
| ARG NEXT_PUBLIC_WS_URL | |
| ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL | |
| ENV NEXT_PUBLIC_APP_URL=$NEXT_PUBLIC_APP_URL | |
| ENV NEXT_PUBLIC_WS_URL=$NEXT_PUBLIC_WS_URL | |
| # Build the application | |
| RUN npm run build | |
| # Stage 3: Runner | |
| FROM node:20-alpine AS runner | |
| WORKDIR /app | |
| ENV NODE_ENV production | |
| # Create non-root user | |
| RUN addgroup --system --gid 1001 nodejs | |
| RUN adduser --system --uid 1001 nextjs | |
| # Copy necessary files | |
| COPY --from=builder /app/public ./public | |
| # Set correct permissions for prerender cache | |
| RUN mkdir .next | |
| RUN chown nextjs:nodejs .next | |
| # Copy build output | |
| COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | |
| COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | |
| USER nextjs | |
| EXPOSE 3000 | |
| ENV PORT 3000 | |
| ENV HOSTNAME "0.0.0.0" | |
| CMD ["node", "server.js"] |