veltrixcode commited on
Commit
b22ca5d
·
verified ·
1 Parent(s): 1feb024

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -72
Dockerfile CHANGED
@@ -1,80 +1,19 @@
1
- # ==========================================
2
- # STAGE 1: Builder
3
- # ==========================================
4
- FROM ubuntu:22.04 AS builder
5
-
6
- # Prevent interactive prompts
7
- ENV DEBIAN_FRONTEND=noninteractive
8
-
9
- # Update system and install build dependencies
10
- # curl, ca-certificates, gnupg: for Node.js
11
- # openssl: for Prisma
12
- RUN apt-get update && apt-get install -y \
13
- curl \
14
- ca-certificates \
15
- openssl \
16
- gnupg \
17
- && rm -rf /var/lib/apt/lists/*
18
-
19
- # Install Node.js 20 (LTS)
20
- RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
21
- && apt-get install -y nodejs \
22
- && rm -rf /var/lib/apt/lists/*
23
 
 
24
  WORKDIR /app
25
 
26
- # Copy package files first for caching
27
- COPY package*.json ./
28
- COPY prisma ./prisma/
29
-
30
- # Install dependencies (including devDependencies for build)
31
- RUN npm install
32
 
33
- # Copy source code
34
  COPY . .
35
 
36
- # Generate Prisma Client and Build
37
- # Prisma client will be generated for "native" and "debian-openssl-*" targets per schema
38
- RUN npx prisma generate
39
- RUN npm run build
40
-
41
- # ==========================================
42
- # STAGE 2: Runner
43
- # ==========================================
44
- FROM ubuntu:22.04 AS runner
45
-
46
- # Prevent interactive prompts
47
- ENV DEBIAN_FRONTEND=noninteractive
48
-
49
- # Update system and install runtime dependencies
50
- # We need openssl for Prisma runtime
51
- RUN apt-get update && apt-get install -y \
52
- curl \
53
- ca-certificates \
54
- openssl \
55
- && rm -rf /var/lib/apt/lists/*
56
-
57
- # Install Node.js 20 (LTS) - Optimized for runtime
58
- RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
59
- && apt-get install -y nodejs \
60
- && rm -rf /var/lib/apt/lists/*
61
-
62
- WORKDIR /app
63
-
64
- # Set environment to production
65
- ENV NODE_ENV=production
66
-
67
- # Copy built artifacts from builder stage
68
- # We use the specific path from the builder's output
69
- COPY --from=builder /app/public ./public
70
- COPY --from=builder /app/.next/static ./.next/static
71
- COPY --from=builder /app/.next/standalone ./
72
-
73
- # Expose port
74
- EXPOSE 3000
75
-
76
- ENV HOSTNAME="0.0.0.0"
77
  ENV PORT=7860
78
 
79
- # Start server
80
- CMD ["node", "server.js"]
 
 
 
1
+ FROM node:18-slim
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ # Create app directory
4
  WORKDIR /app
5
 
6
+ # Install dependencies
7
+ COPY package.json package-lock.json* ./
8
+ RUN npm ci --omit=dev || npm install --omit=dev
 
 
 
9
 
10
+ # Bundle app source
11
  COPY . .
12
 
13
+ # Hugging Face Spaces expect the app to listen on $PORT
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  ENV PORT=7860
15
 
16
+ # Expose the port (for documentation only)
17
+ EXPOSE 7860
18
+
19
+ CMD ["npm", "start"]