chore(frontend): add .dockerignore file to exclude unnecessary files from Docker context
This commit is contained in:
parent
62a47cc7d2
commit
e2d3483de2
61
frontend/.dockerignore
Normal file
61
frontend/.dockerignore
Normal file
@ -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/
|
@ -4,24 +4,32 @@ FROM node:20.15.1-alpine AS builder
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Define build arguments with default values
|
# 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
|
RUN npm install -g pnpm
|
||||||
|
|
||||||
# Install dependencies first (caching)
|
# Copy package files first for better caching
|
||||||
COPY package.json pnpm-lock.yaml ./
|
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
|
RUN pnpm install --no-frozen-lockfile
|
||||||
|
|
||||||
# Instalar explicitamente o next-runtime-env
|
|
||||||
RUN pnpm add next-runtime-env
|
RUN pnpm add next-runtime-env
|
||||||
|
|
||||||
# Copy source code
|
# Copy all source code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Set environment variables from build arguments
|
# Set environment variables from build arguments
|
||||||
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
||||||
|
|
||||||
|
# Build the application
|
||||||
RUN pnpm run build
|
RUN pnpm run build
|
||||||
|
|
||||||
# Production stage
|
# Production stage
|
||||||
@ -32,14 +40,12 @@ WORKDIR /app
|
|||||||
# Define build arguments again for the runner stage
|
# Define build arguments again for the runner stage
|
||||||
ARG NEXT_PUBLIC_API_URL=https://api-evoai.evoapicloud.com
|
ARG NEXT_PUBLIC_API_URL=https://api-evoai.evoapicloud.com
|
||||||
|
|
||||||
# Instalar pnpm globalmente
|
|
||||||
RUN npm install -g pnpm
|
RUN npm install -g pnpm
|
||||||
|
|
||||||
# Install production dependencies only
|
# Install production dependencies only
|
||||||
COPY package.json pnpm-lock.yaml ./
|
COPY package.json pnpm-lock.yaml ./
|
||||||
RUN pnpm install --prod --no-frozen-lockfile
|
RUN pnpm install --prod --no-frozen-lockfile
|
||||||
|
|
||||||
# Instalar explicitamente o next-runtime-env na produção
|
|
||||||
RUN pnpm add next-runtime-env
|
RUN pnpm add next-runtime-env
|
||||||
|
|
||||||
# Copy built assets from builder
|
# Copy built assets from builder
|
||||||
@ -52,7 +58,7 @@ ENV NODE_ENV=production
|
|||||||
ENV PORT=3000
|
ENV PORT=3000
|
||||||
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
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 ./
|
COPY docker-entrypoint.sh ./
|
||||||
RUN chmod +x ./docker-entrypoint.sh
|
RUN chmod +x ./docker-entrypoint.sh
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user