underrate commited on
Commit
c1d394b
·
verified ·
1 Parent(s): 34ed5b1

Upload 3 files

Browse files
Files changed (3) hide show
  1. .dockerignore +41 -0
  2. Dockerfile +50 -0
  3. next.config.ts +1 -1
.dockerignore ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dependencies
2
+ node_modules
3
+ npm-debug.log*
4
+ yarn-debug.log*
5
+ yarn-error.log*
6
+
7
+ # Next.js
8
+ .next
9
+ out
10
+
11
+ # Build
12
+ dist
13
+ build
14
+
15
+ # Testing
16
+ coverage
17
+
18
+ # IDE
19
+ .idea
20
+ .vscode
21
+ *.swp
22
+ *.swo
23
+
24
+ # OS
25
+ .DS_Store
26
+ Thumbs.db
27
+
28
+ # Git
29
+ .git
30
+ .gitignore
31
+
32
+ # Docker
33
+ Dockerfile
34
+ .dockerignore
35
+ docker-compose*
36
+
37
+ # Misc
38
+ *.log
39
+ *.md
40
+ .env*
41
+ !.env.example
Dockerfile ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Build stage
2
+ FROM node:20-alpine AS builder
3
+
4
+ WORKDIR /app
5
+
6
+ # Copy package files
7
+ COPY package.json package-lock.json* ./
8
+
9
+ # Install dependencies
10
+ RUN npm ci
11
+
12
+ # Copy source files
13
+ COPY . .
14
+
15
+ # Build the application
16
+ RUN npm run build
17
+
18
+ # Production stage
19
+ FROM node:20-alpine AS runner
20
+
21
+ WORKDIR /app
22
+
23
+ # Set to production
24
+ ENV NODE_ENV=production
25
+ ENV NEXT_TELEMETRY_DISABLED=1
26
+
27
+ # Create non-root user for security
28
+ RUN addgroup --system --gid 1001 nodejs
29
+ RUN adduser --system --uid 1001 nextjs
30
+
31
+ # Copy necessary files from builder
32
+ COPY --from=builder /app/public ./public
33
+ COPY --from=builder /app/.next/standalone ./
34
+ COPY --from=builder /app/.next/static ./.next/static
35
+
36
+ # Set correct ownership
37
+ RUN chown -R nextjs:nodejs /app
38
+
39
+ # Switch to non-root user
40
+ USER nextjs
41
+
42
+ # Expose port (Hugging Face Spaces uses 7860)
43
+ EXPOSE 7860
44
+
45
+ # Set port
46
+ ENV PORT=7860
47
+ ENV HOSTNAME="0.0.0.0"
48
+
49
+ # Start the application
50
+ CMD ["node", "server.js"]
next.config.ts CHANGED
@@ -1,7 +1,7 @@
1
  import type { NextConfig } from "next";
2
 
3
  const nextConfig: NextConfig = {
4
- /* config options here */
5
  };
6
 
7
  export default nextConfig;
 
1
  import type { NextConfig } from "next";
2
 
3
  const nextConfig: NextConfig = {
4
+ output: "standalone",
5
  };
6
 
7
  export default nextConfig;