chore(frontend): add .dockerignore file to exclude unnecessary files from Docker context
This commit is contained in:
@@ -4,24 +4,32 @@ FROM node:20.15.1-alpine AS builder
|
||||
WORKDIR /app
|
||||
|
||||
# Define build arguments with default values
|
||||
ARG NEXT_PUBLIC_API_URL=https://api-evoai.evoapicloud.com
|
||||
ARG NEXT_PUBLIC_API_URL=https://api.evo-ai.co
|
||||
|
||||
# Instalar pnpm globalmente
|
||||
RUN npm install -g pnpm
|
||||
|
||||
# Install dependencies first (caching)
|
||||
# Copy package files first for better caching
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
|
||||
# Copy configuration files that are needed for dependency resolution
|
||||
COPY tsconfig.json ./
|
||||
COPY next.config.mjs ./
|
||||
COPY tailwind.config.ts ./
|
||||
COPY postcss.config.mjs ./
|
||||
COPY components.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN pnpm install --no-frozen-lockfile
|
||||
|
||||
# Instalar explicitamente o next-runtime-env
|
||||
RUN pnpm add next-runtime-env
|
||||
|
||||
# Copy source code
|
||||
# Copy all source code
|
||||
COPY . .
|
||||
|
||||
# Set environment variables from build arguments
|
||||
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
||||
|
||||
# Build the application
|
||||
RUN pnpm run build
|
||||
|
||||
# Production stage
|
||||
@@ -32,14 +40,12 @@ WORKDIR /app
|
||||
# Define build arguments again for the runner stage
|
||||
ARG NEXT_PUBLIC_API_URL=https://api-evoai.evoapicloud.com
|
||||
|
||||
# Instalar pnpm globalmente
|
||||
RUN npm install -g pnpm
|
||||
|
||||
# Install production dependencies only
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install --prod --no-frozen-lockfile
|
||||
|
||||
# Instalar explicitamente o next-runtime-env na produção
|
||||
RUN pnpm add next-runtime-env
|
||||
|
||||
# Copy built assets from builder
|
||||
@@ -52,7 +58,7 @@ ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
||||
|
||||
# Script to replace environment variables at runtime - create it diretamente no container
|
||||
# Script to replace environment variables at runtime
|
||||
COPY docker-entrypoint.sh ./
|
||||
RUN chmod +x ./docker-entrypoint.sh
|
||||
|
||||
|
||||
Reference in New Issue
Block a user