From 583dfbda5327a56a27adcffc6b92a660fe8b81a3 Mon Sep 17 00:00:00 2001 From: Stijnus Date: Tue, 16 Sep 2025 11:39:39 +0200 Subject: [PATCH 1/5] fix: update Docker workflow to use correct target stage name - Change target from bolt-ai-production to runtime - Matches the actual stage name in the new Dockerfile structure - Fixes CI failure: target stage 'bolt-ai-production' could not be found --- .github/workflows/docker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 32ea67ed52..0fa38eec8a 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -57,7 +57,7 @@ jobs: with: context: . platforms: linux/amd64,linux/arm64 - target: bolt-ai-production + target: runtime push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From cdeb64f5ef458e0a6f0958898172a7aed4a75a7c Mon Sep 17 00:00:00 2001 From: Claude Code <72551117+Stijnus@users.noreply.github.com> Date: Sat, 27 Sep 2025 17:12:56 +0200 Subject: [PATCH 2/5] fix: resolve critical Docker configuration issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes multiple critical Docker configuration issues that prevented successful builds: **Dockerfile Issues Fixed:** - Replace incomplete runtime stage with proper production stage using Wrangler - Add missing environment variables for all API providers (DeepSeek, LMStudio, Mistral, Perplexity, OpenAI-like) - Use correct port (5173) instead of 3000 to match Wrangler configuration - Add proper bindings.sh script copying and execution permissions - Configure Wrangler metrics and proper startup command **Docker Compose Issues Fixed:** - Add missing `context` and `dockerfile` fields to app-dev service - Fix target name from `bolt-ai-development` to `development` **Package.json Issues Fixed:** - Update dockerbuild script to use correct target name `development` **Testing:** - ✅ Both `pnpm run dockerbuild` and `pnpm run dockerbuild:prod` now work - ✅ All environment variables properly configured - ✅ Docker images build successfully with proper Wrangler integration Resolves Docker build failures and enables proper containerized deployment. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- Dockerfile | 90 +++++++++++++++++++++++++++++++++++++++------ docker-compose.yaml | 4 +- package.json | 2 +- 3 files changed, 83 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 44960e2926..e577c2a8dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,37 +29,90 @@ RUN NODE_OPTIONS=--max-old-space-size=4096 pnpm run build RUN pnpm prune --prod --ignore-scripts -# ---- runtime stage ---- -FROM node:22-bookworm-slim AS runtime +# ---- production stage ---- +FROM build AS bolt-ai-production WORKDIR /app ENV NODE_ENV=production -ENV PORT=3000 +ENV PORT=5173 ENV HOST=0.0.0.0 -# Install curl so Coolify’s healthcheck works inside the image +# Production environment variables +ARG GROQ_API_KEY +ARG HuggingFace_API_KEY +ARG OPENAI_API_KEY +ARG ANTHROPIC_API_KEY +ARG OPEN_ROUTER_API_KEY +ARG GOOGLE_GENERATIVE_AI_API_KEY +ARG OLLAMA_API_BASE_URL +ARG XAI_API_KEY +ARG TOGETHER_API_KEY +ARG TOGETHER_API_BASE_URL +ARG AWS_BEDROCK_CONFIG +ARG DEEPSEEK_API_KEY +ARG LMSTUDIO_API_BASE_URL +ARG MISTRAL_API_KEY +ARG PERPLEXITY_API_KEY +ARG OPENAI_LIKE_API_KEY +ARG OPENAI_LIKE_API_BASE_URL +ARG OPENAI_LIKE_API_MODELS +ARG VITE_LOG_LEVEL=debug +ARG DEFAULT_NUM_CTX + +ENV WRANGLER_SEND_METRICS=false \ + GROQ_API_KEY=${GROQ_API_KEY} \ + HuggingFace_API_KEY=${HuggingFace_API_KEY} \ + OPENAI_API_KEY=${OPENAI_API_KEY} \ + ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} \ + OPEN_ROUTER_API_KEY=${OPEN_ROUTER_API_KEY} \ + GOOGLE_GENERATIVE_AI_API_KEY=${GOOGLE_GENERATIVE_AI_API_KEY} \ + OLLAMA_API_BASE_URL=${OLLAMA_API_BASE_URL} \ + XAI_API_KEY=${XAI_API_KEY} \ + TOGETHER_API_KEY=${TOGETHER_API_KEY} \ + TOGETHER_API_BASE_URL=${TOGETHER_API_BASE_URL} \ + AWS_BEDROCK_CONFIG=${AWS_BEDROCK_CONFIG} \ + DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY} \ + LMSTUDIO_API_BASE_URL=${LMSTUDIO_API_BASE_URL} \ + MISTRAL_API_KEY=${MISTRAL_API_KEY} \ + PERPLEXITY_API_KEY=${PERPLEXITY_API_KEY} \ + OPENAI_LIKE_API_KEY=${OPENAI_LIKE_API_KEY} \ + OPENAI_LIKE_API_BASE_URL=${OPENAI_LIKE_API_BASE_URL} \ + OPENAI_LIKE_API_MODELS=${OPENAI_LIKE_API_MODELS} \ + VITE_LOG_LEVEL=${VITE_LOG_LEVEL} \ + DEFAULT_NUM_CTX=${DEFAULT_NUM_CTX} \ + RUNNING_IN_DOCKER=true + +# Install curl for healthchecks and copy bindings script RUN apt-get update && apt-get install -y --no-install-recommends curl \ && rm -rf /var/lib/apt/lists/* -# Copy only what we need to run +# Copy built files and scripts COPY --from=build /app/build /app/build COPY --from=build /app/node_modules /app/node_modules COPY --from=build /app/package.json /app/package.json +COPY --from=build /app/bindings.sh /app/bindings.sh + +# Pre-configure wrangler to disable metrics +RUN mkdir -p /root/.config/.wrangler && \ + echo '{"enabled":false}' > /root/.config/.wrangler/metrics.json + +# Make bindings script executable +RUN chmod +x /app/bindings.sh -EXPOSE 3000 +EXPOSE 5173 -# Healthcheck for Coolify +# Healthcheck for deployment platforms HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=5 \ - CMD curl -fsS http://localhost:3000/ || exit 1 + CMD curl -fsS http://localhost:5173/ || exit 1 -# Start the Remix server -CMD ["node", "build/server/index.js"] +# Start using dockerstart script with Wrangler +CMD ["pnpm", "run", "dockerstart"] # ---- development stage ---- FROM build AS development -# Define environment variables for development +# Define the same environment variables for development ARG GROQ_API_KEY ARG HuggingFace_API_KEY ARG OPENAI_API_KEY @@ -70,6 +123,14 @@ ARG OLLAMA_API_BASE_URL ARG XAI_API_KEY ARG TOGETHER_API_KEY ARG TOGETHER_API_BASE_URL +ARG AWS_BEDROCK_CONFIG +ARG DEEPSEEK_API_KEY +ARG LMSTUDIO_API_BASE_URL +ARG MISTRAL_API_KEY +ARG PERPLEXITY_API_KEY +ARG OPENAI_LIKE_API_KEY +ARG OPENAI_LIKE_API_BASE_URL +ARG OPENAI_LIKE_API_MODELS ARG VITE_LOG_LEVEL=debug ARG DEFAULT_NUM_CTX @@ -84,6 +145,13 @@ ENV GROQ_API_KEY=${GROQ_API_KEY} \ TOGETHER_API_KEY=${TOGETHER_API_KEY} \ TOGETHER_API_BASE_URL=${TOGETHER_API_BASE_URL} \ AWS_BEDROCK_CONFIG=${AWS_BEDROCK_CONFIG} \ + DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY} \ + LMSTUDIO_API_BASE_URL=${LMSTUDIO_API_BASE_URL} \ + MISTRAL_API_KEY=${MISTRAL_API_KEY} \ + PERPLEXITY_API_KEY=${PERPLEXITY_API_KEY} \ + OPENAI_LIKE_API_KEY=${OPENAI_LIKE_API_KEY} \ + OPENAI_LIKE_API_BASE_URL=${OPENAI_LIKE_API_BASE_URL} \ + OPENAI_LIKE_API_MODELS=${OPENAI_LIKE_API_MODELS} \ VITE_LOG_LEVEL=${VITE_LOG_LEVEL} \ DEFAULT_NUM_CTX=${DEFAULT_NUM_CTX} \ RUNNING_IN_DOCKER=true diff --git a/docker-compose.yaml b/docker-compose.yaml index 2aa38ae0bf..aff491123a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -38,7 +38,9 @@ services: app-dev: image: bolt-ai:development build: - target: bolt-ai-development + context: . + dockerfile: Dockerfile + target: development env_file: - '.env' - '.env.local' diff --git a/package.json b/package.json index 9352faeef9..1547920ce1 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "dockerstart": "bindings=$(./bindings.sh) && wrangler pages dev ./build/client $bindings --ip 0.0.0.0 --port 5173 --no-show-interactive-dev-session", "dockerrun": "docker run -it -d --name bolt-ai-live -p 5173:5173 --env-file .env.local bolt-ai", "dockerbuild:prod": "docker build -t bolt-ai:production -t bolt-ai:latest --target bolt-ai-production .", - "dockerbuild": "docker build -t bolt-ai:development -t bolt-ai:latest --target bolt-ai-development .", + "dockerbuild": "docker build -t bolt-ai:development -t bolt-ai:latest --target development .", "typecheck": "tsc", "typegen": "wrangler types", "preview": "pnpm run build && pnpm run start", From e09e6f5336f91617d331e25a0f932c79cb77e640 Mon Sep 17 00:00:00 2001 From: Claude Code <72551117+Stijnus@users.noreply.github.com> Date: Mon, 29 Sep 2025 11:52:43 +0200 Subject: [PATCH 3/5] Update Dockerfile --- Dockerfile | 86 +++++++----------------------------------------------- 1 file changed, 11 insertions(+), 75 deletions(-) diff --git a/Dockerfile b/Dockerfile index e577c2a8dc..27478aaaa3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,51 +37,19 @@ ENV NODE_ENV=production ENV PORT=5173 ENV HOST=0.0.0.0 -# Production environment variables -ARG GROQ_API_KEY -ARG HuggingFace_API_KEY -ARG OPENAI_API_KEY -ARG ANTHROPIC_API_KEY -ARG OPEN_ROUTER_API_KEY -ARG GOOGLE_GENERATIVE_AI_API_KEY -ARG OLLAMA_API_BASE_URL -ARG XAI_API_KEY -ARG TOGETHER_API_KEY -ARG TOGETHER_API_BASE_URL -ARG AWS_BEDROCK_CONFIG -ARG DEEPSEEK_API_KEY -ARG LMSTUDIO_API_BASE_URL -ARG MISTRAL_API_KEY -ARG PERPLEXITY_API_KEY -ARG OPENAI_LIKE_API_KEY -ARG OPENAI_LIKE_API_BASE_URL -ARG OPENAI_LIKE_API_MODELS +# Non-sensitive build arguments ARG VITE_LOG_LEVEL=debug ARG DEFAULT_NUM_CTX +# Set non-sensitive environment variables ENV WRANGLER_SEND_METRICS=false \ - GROQ_API_KEY=${GROQ_API_KEY} \ - HuggingFace_API_KEY=${HuggingFace_API_KEY} \ - OPENAI_API_KEY=${OPENAI_API_KEY} \ - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} \ - OPEN_ROUTER_API_KEY=${OPEN_ROUTER_API_KEY} \ - GOOGLE_GENERATIVE_AI_API_KEY=${GOOGLE_GENERATIVE_AI_API_KEY} \ - OLLAMA_API_BASE_URL=${OLLAMA_API_BASE_URL} \ - XAI_API_KEY=${XAI_API_KEY} \ - TOGETHER_API_KEY=${TOGETHER_API_KEY} \ - TOGETHER_API_BASE_URL=${TOGETHER_API_BASE_URL} \ - AWS_BEDROCK_CONFIG=${AWS_BEDROCK_CONFIG} \ - DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY} \ - LMSTUDIO_API_BASE_URL=${LMSTUDIO_API_BASE_URL} \ - MISTRAL_API_KEY=${MISTRAL_API_KEY} \ - PERPLEXITY_API_KEY=${PERPLEXITY_API_KEY} \ - OPENAI_LIKE_API_KEY=${OPENAI_LIKE_API_KEY} \ - OPENAI_LIKE_API_BASE_URL=${OPENAI_LIKE_API_BASE_URL} \ - OPENAI_LIKE_API_MODELS=${OPENAI_LIKE_API_MODELS} \ VITE_LOG_LEVEL=${VITE_LOG_LEVEL} \ DEFAULT_NUM_CTX=${DEFAULT_NUM_CTX} \ RUNNING_IN_DOCKER=true +# Note: API keys should be provided at runtime via docker run -e or docker-compose +# Example: docker run -e OPENAI_API_KEY=your_key_here ... + # Install curl for healthchecks and copy bindings script RUN apt-get update && apt-get install -y --no-install-recommends curl \ && rm -rf /var/lib/apt/lists/* @@ -112,49 +80,17 @@ CMD ["pnpm", "run", "dockerstart"] # ---- development stage ---- FROM build AS development -# Define the same environment variables for development -ARG GROQ_API_KEY -ARG HuggingFace_API_KEY -ARG OPENAI_API_KEY -ARG ANTHROPIC_API_KEY -ARG OPEN_ROUTER_API_KEY -ARG GOOGLE_GENERATIVE_AI_API_KEY -ARG OLLAMA_API_BASE_URL -ARG XAI_API_KEY -ARG TOGETHER_API_KEY -ARG TOGETHER_API_BASE_URL -ARG AWS_BEDROCK_CONFIG -ARG DEEPSEEK_API_KEY -ARG LMSTUDIO_API_BASE_URL -ARG MISTRAL_API_KEY -ARG PERPLEXITY_API_KEY -ARG OPENAI_LIKE_API_KEY -ARG OPENAI_LIKE_API_BASE_URL -ARG OPENAI_LIKE_API_MODELS +# Non-sensitive development arguments ARG VITE_LOG_LEVEL=debug ARG DEFAULT_NUM_CTX -ENV GROQ_API_KEY=${GROQ_API_KEY} \ - HuggingFace_API_KEY=${HuggingFace_API_KEY} \ - OPENAI_API_KEY=${OPENAI_API_KEY} \ - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} \ - OPEN_ROUTER_API_KEY=${OPEN_ROUTER_API_KEY} \ - GOOGLE_GENERATIVE_AI_API_KEY=${GOOGLE_GENERATIVE_AI_API_KEY} \ - OLLAMA_API_BASE_URL=${OLLAMA_API_BASE_URL} \ - XAI_API_KEY=${XAI_API_KEY} \ - TOGETHER_API_KEY=${TOGETHER_API_KEY} \ - TOGETHER_API_BASE_URL=${TOGETHER_API_BASE_URL} \ - AWS_BEDROCK_CONFIG=${AWS_BEDROCK_CONFIG} \ - DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY} \ - LMSTUDIO_API_BASE_URL=${LMSTUDIO_API_BASE_URL} \ - MISTRAL_API_KEY=${MISTRAL_API_KEY} \ - PERPLEXITY_API_KEY=${PERPLEXITY_API_KEY} \ - OPENAI_LIKE_API_KEY=${OPENAI_LIKE_API_KEY} \ - OPENAI_LIKE_API_BASE_URL=${OPENAI_LIKE_API_BASE_URL} \ - OPENAI_LIKE_API_MODELS=${OPENAI_LIKE_API_MODELS} \ - VITE_LOG_LEVEL=${VITE_LOG_LEVEL} \ +# Set non-sensitive environment variables for development +ENV VITE_LOG_LEVEL=${VITE_LOG_LEVEL} \ DEFAULT_NUM_CTX=${DEFAULT_NUM_CTX} \ RUNNING_IN_DOCKER=true +# Note: API keys should be provided at runtime via docker run -e or docker-compose +# Example: docker run -e OPENAI_API_KEY=your_key_here ... + RUN mkdir -p /app/run CMD ["pnpm", "run", "dev", "--host"] From 77fa136b90a5098403bb25e9a3f3bdda9eb8e1d1 Mon Sep 17 00:00:00 2001 From: Stijnus Date: Tue, 30 Sep 2025 15:19:12 +0200 Subject: [PATCH 4/5] fix: update GitHub workflow Docker targets to match Dockerfile stage names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update ci.yaml and docker.yaml workflows to use correct Docker target stage name 'bolt-ai-production' instead of 'runtime'. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/ci.yaml | 2 +- .github/workflows/docker.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 12434a0c9f..18b6f35bd8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -74,7 +74,7 @@ jobs: - name: Validate Docker production build run: | echo "🐳 Testing Docker production target..." - docker build --target runtime . --no-cache --progress=plain + docker build --target bolt-ai-production . --no-cache --progress=plain echo "✅ Production target builds successfully" - name: Validate Docker development build diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 0fa38eec8a..32ea67ed52 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -57,7 +57,7 @@ jobs: with: context: . platforms: linux/amd64,linux/arm64 - target: runtime + target: bolt-ai-production push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 02023f9f2b1590079282e1478883b01440174619 Mon Sep 17 00:00:00 2001 From: Stijnus Date: Mon, 20 Oct 2025 23:27:27 +0200 Subject: [PATCH 5/5] Refactor Dockerfile for optimized production build Adds git installation for build/runtime scripts and introduces a separate prod-deps stage to prune dependencies before final production image. Updates file copy sources to use prod-deps stage, improving build efficiency and image size. --- Dockerfile | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 27478aaaa3..1ad0c1d162 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,10 @@ ENV CI=true # Use pnpm RUN corepack enable && corepack prepare pnpm@9.15.9 --activate +# Ensure git is available for build and runtime scripts +RUN apt-get update && apt-get install -y --no-install-recommends git \ + && rm -rf /var/lib/apt/lists/* + # Accept (optional) build-time public URL for Remix/Vite (Coolify can pass it) ARG VITE_PUBLIC_APP_URL ENV VITE_PUBLIC_APP_URL=${VITE_PUBLIC_APP_URL} @@ -25,12 +29,15 @@ RUN pnpm install --offline --frozen-lockfile # Build the Remix app (SSR + client) RUN NODE_OPTIONS=--max-old-space-size=4096 pnpm run build +# ---- production dependencies stage ---- +FROM build AS prod-deps + # Keep only production deps for runtime RUN pnpm prune --prod --ignore-scripts # ---- production stage ---- -FROM build AS bolt-ai-production +FROM prod-deps AS bolt-ai-production WORKDIR /app ENV NODE_ENV=production @@ -55,10 +62,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends curl \ && rm -rf /var/lib/apt/lists/* # Copy built files and scripts -COPY --from=build /app/build /app/build -COPY --from=build /app/node_modules /app/node_modules -COPY --from=build /app/package.json /app/package.json -COPY --from=build /app/bindings.sh /app/bindings.sh +COPY --from=prod-deps /app/build /app/build +COPY --from=prod-deps /app/node_modules /app/node_modules +COPY --from=prod-deps /app/package.json /app/package.json +COPY --from=prod-deps /app/bindings.sh /app/bindings.sh # Pre-configure wrangler to disable metrics RUN mkdir -p /root/.config/.wrangler && \