@@ -4,24 +4,32 @@ FROM node:20.15.1-alpine AS builder
4
4
WORKDIR /app
5
5
6
6
# Define build arguments with default values
7
- ARG NEXT_PUBLIC_API_URL=https://api-evoai.evoapicloud.com
7
+ ARG NEXT_PUBLIC_API_URL=https://api.evo-ai.co
8
8
9
- # Instalar pnpm globalmente
10
9
RUN npm install -g pnpm
11
10
12
- # Install dependencies first ( caching)
11
+ # Copy package files first for better caching
13
12
COPY package.json pnpm-lock.yaml ./
13
+
14
+ # Copy configuration files that are needed for dependency resolution
15
+ COPY tsconfig.json ./
16
+ COPY next.config.mjs ./
17
+ COPY tailwind.config.ts ./
18
+ COPY postcss.config.mjs ./
19
+ COPY components.json ./
20
+
21
+ # Install dependencies
14
22
RUN pnpm install --no-frozen-lockfile
15
23
16
- # Instalar explicitamente o next-runtime-env
17
24
RUN pnpm add next-runtime-env
18
25
19
- # Copy source code
26
+ # Copy all source code
20
27
COPY . .
21
28
22
29
# Set environment variables from build arguments
23
30
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
24
31
32
+ # Build the application
25
33
RUN pnpm run build
26
34
27
35
# Production stage
@@ -32,14 +40,12 @@ WORKDIR /app
32
40
# Define build arguments again for the runner stage
33
41
ARG NEXT_PUBLIC_API_URL=https://api-evoai.evoapicloud.com
34
42
35
- # Instalar pnpm globalmente
36
43
RUN npm install -g pnpm
37
44
38
45
# Install production dependencies only
39
46
COPY package.json pnpm-lock.yaml ./
40
47
RUN pnpm install --prod --no-frozen-lockfile
41
48
42
- # Instalar explicitamente o next-runtime-env na produção
43
49
RUN pnpm add next-runtime-env
44
50
45
51
# Copy built assets from builder
@@ -52,7 +58,7 @@ ENV NODE_ENV=production
52
58
ENV PORT=3000
53
59
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
54
60
55
- # Script to replace environment variables at runtime - create it diretamente no container
61
+ # Script to replace environment variables at runtime
56
62
COPY docker-entrypoint.sh ./
57
63
RUN chmod +x ./docker-entrypoint.sh
58
64
0 commit comments