diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8deaf78 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,52 @@ +# .dockerignore +node_modules +npm-debug.log +.git +.gitignore +.env +.env.local +# Keep nodes.db but exclude other database files +data/*.db +!data/nodes.db +dist +.DS_Store +*.log +coverage +.nyc_output +.vscode +.idea +*.swp +*.swo +*~ +docker-compose.override.yml +.github +docs +tests +jest.config.js +.eslintrc.js +*.md +!README.md +!LICENSE +# Exclude n8n-docs if present +../n8n-docs +n8n-docs +# Exclude extracted nodes +extracted-nodes/ +# Exclude temp directory +temp/ +# Exclude any backup or temporary files +*.bak +*.tmp +*.temp +# Exclude build artifacts +build/ +out/ +# Exclude local development files +.eslintcache +.stylelintcache +# Exclude any large test data +test-data/ +# Exclude Docker files during build +Dockerfile* +docker-compose*.yml +.dockerignore \ No newline at end of file diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index a78823c..c25e187 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -34,10 +34,6 @@ jobs: - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v3 - with: - driver-opts: | - memory=8g - memory-swap=16g - name: Log in to GitHub Container Registry if: github.event_name != 'pull_request' @@ -74,9 +70,6 @@ jobs: build-args: | BUILDKIT_INLINE_CACHE=1 provenance: false - # Add build constraints to prevent OOM - builder: ${{ steps.buildx.outputs.name }} - no-cache-filters: db-builder # Nginx build commented out until Phase 2 # build-nginx: diff --git a/.gitignore b/.gitignore index 2d6ae31..a6cbb8f 100644 --- a/.gitignore +++ b/.gitignore @@ -51,7 +51,6 @@ coverage/ .yarn-integrity # Docker -.dockerignore docker-compose.override.yml # Miscellaneous diff --git a/Dockerfile b/Dockerfile index 4afd076..bba18b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -# Optimized Dockerfile - builds database at build time, minimal runtime image +# Optimized Dockerfile - uses pre-built database for faster, more reliable builds # Stage 1: Dependencies (includes n8n for building) FROM node:20-alpine AS deps @@ -21,25 +21,7 @@ COPY . . # Build TypeScript RUN npm run build -# Stage 3: Database Builder (extracts all node info and builds database) -FROM builder AS db-builder -WORKDIR /app -# Clone n8n-docs for documentation (if available) -# Fix git SSL issues in Alpine and configure git properly -RUN apk add --no-cache git ca-certificates && \ - git config --global http.sslVerify false && \ - git config --global init.defaultBranch main && \ - git clone --depth 1 https://github.com/n8n-io/n8n-docs.git /tmp/n8n-docs 2>/dev/null || \ - echo "Warning: Could not clone n8n-docs, continuing without documentation" -ENV N8N_DOCS_PATH=/tmp/n8n-docs -# Build the complete database with source code -RUN mkdir -p data && \ - npm run rebuild:optimized || \ - (echo "Warning: Optimized rebuild failed, trying regular rebuild" && \ - npm run rebuild) || \ - (echo "Error: Database build failed" && exit 1) - -# Stage 4: Minimal Runtime (no n8n packages) +# Stage 3: Minimal Runtime (no n8n packages) FROM node:20-alpine AS runtime WORKDIR /app @@ -69,8 +51,8 @@ RUN npm config set fetch-retries 5 && \ # Copy built application COPY --from=builder /app/dist ./dist -# Copy pre-built database with all source code -COPY --from=db-builder /app/data/nodes.db ./data/ +# Copy pre-built database from source +COPY data/nodes.db ./data/ # Copy minimal required files COPY src/database/schema-optimized.sql ./src/database/