diff --git a/frontend/.dockerignore b/frontend/.dockerignore new file mode 100644 index 00000000..76b82d9d --- /dev/null +++ b/frontend/.dockerignore @@ -0,0 +1,61 @@ +# Dependencies +node_modules +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# Production builds +.next/ +out/ +dist/ + +# Environment variables +.env +.env.local +.env.development.local +.env.test.local +.env.production.local + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Logs +logs +*.log + +# Temporary files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +# IDEs and editors +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# Git +.git +.gitignore + +# Docker +Dockerfile* +docker-compose* +.dockerignore + +# Testing +coverage/ +.nyc_output +.coverage + +# Other +.cache/ \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 9081d6a0..1d608f0e 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -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