Skip to content

Commit 49850d9

Browse files
Stijnusclaude
andauthored
fix: resolve critical Docker configuration issues (#2020)
* 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 * fix: resolve critical Docker configuration issues 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 <[email protected]> * Update Dockerfile * fix: update GitHub workflow Docker targets to match Dockerfile stage names 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 <[email protected]> * 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. --------- Co-authored-by: Claude <[email protected]>
1 parent 1a55bd5 commit 49850d9

File tree

5 files changed

+53
-40
lines changed

5 files changed

+53
-40
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
- name: Validate Docker production build
7575
run: |
7676
echo "🐳 Testing Docker production target..."
77-
docker build --target runtime . --no-cache --progress=plain
77+
docker build --target bolt-ai-production . --no-cache --progress=plain
7878
echo "✅ Production target builds successfully"
7979
8080
- name: Validate Docker development build

.github/workflows/docker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
with:
5858
context: .
5959
platforms: linux/amd64,linux/arm64
60-
target: runtime
60+
target: bolt-ai-production
6161
push: true
6262
tags: ${{ steps.meta.outputs.tags }}
6363
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 47 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ ENV CI=true
99
# Use pnpm
1010
RUN corepack enable && corepack prepare [email protected] --activate
1111

12+
# Ensure git is available for build and runtime scripts
13+
RUN apt-get update && apt-get install -y --no-install-recommends git \
14+
&& rm -rf /var/lib/apt/lists/*
15+
1216
# Accept (optional) build-time public URL for Remix/Vite (Coolify can pass it)
1317
ARG VITE_PUBLIC_APP_URL
1418
ENV VITE_PUBLIC_APP_URL=${VITE_PUBLIC_APP_URL}
@@ -25,68 +29,75 @@ RUN pnpm install --offline --frozen-lockfile
2529
# Build the Remix app (SSR + client)
2630
RUN NODE_OPTIONS=--max-old-space-size=4096 pnpm run build
2731

32+
# ---- production dependencies stage ----
33+
FROM build AS prod-deps
34+
2835
# Keep only production deps for runtime
2936
RUN pnpm prune --prod --ignore-scripts
3037

3138

32-
# ---- runtime stage ----
33-
FROM node:22-bookworm-slim AS runtime
39+
# ---- production stage ----
40+
FROM prod-deps AS bolt-ai-production
3441
WORKDIR /app
3542

3643
ENV NODE_ENV=production
37-
ENV PORT=3000
44+
ENV PORT=5173
3845
ENV HOST=0.0.0.0
3946

40-
# Install curl so Coolify’s healthcheck works inside the image
47+
# Non-sensitive build arguments
48+
ARG VITE_LOG_LEVEL=debug
49+
ARG DEFAULT_NUM_CTX
50+
51+
# Set non-sensitive environment variables
52+
ENV WRANGLER_SEND_METRICS=false \
53+
VITE_LOG_LEVEL=${VITE_LOG_LEVEL} \
54+
DEFAULT_NUM_CTX=${DEFAULT_NUM_CTX} \
55+
RUNNING_IN_DOCKER=true
56+
57+
# Note: API keys should be provided at runtime via docker run -e or docker-compose
58+
# Example: docker run -e OPENAI_API_KEY=your_key_here ...
59+
60+
# Install curl for healthchecks and copy bindings script
4161
RUN apt-get update && apt-get install -y --no-install-recommends curl \
4262
&& rm -rf /var/lib/apt/lists/*
4363

44-
# Copy only what we need to run
45-
COPY --from=build /app/build /app/build
46-
COPY --from=build /app/node_modules /app/node_modules
47-
COPY --from=build /app/package.json /app/package.json
64+
# Copy built files and scripts
65+
COPY --from=prod-deps /app/build /app/build
66+
COPY --from=prod-deps /app/node_modules /app/node_modules
67+
COPY --from=prod-deps /app/package.json /app/package.json
68+
COPY --from=prod-deps /app/bindings.sh /app/bindings.sh
69+
70+
# Pre-configure wrangler to disable metrics
71+
RUN mkdir -p /root/.config/.wrangler && \
72+
echo '{"enabled":false}' > /root/.config/.wrangler/metrics.json
4873

49-
EXPOSE 3000
74+
# Make bindings script executable
75+
RUN chmod +x /app/bindings.sh
5076

51-
# Healthcheck for Coolify
77+
EXPOSE 5173
78+
79+
# Healthcheck for deployment platforms
5280
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=5 \
53-
CMD curl -fsS http://localhost:3000/ || exit 1
81+
CMD curl -fsS http://localhost:5173/ || exit 1
5482

55-
# Start the Remix server
56-
CMD ["node", "build/server/index.js"]
83+
# Start using dockerstart script with Wrangler
84+
CMD ["pnpm", "run", "dockerstart"]
5785

5886

5987
# ---- development stage ----
6088
FROM build AS development
6189

62-
# Define environment variables for development
63-
ARG GROQ_API_KEY
64-
ARG HuggingFace_API_KEY
65-
ARG OPENAI_API_KEY
66-
ARG ANTHROPIC_API_KEY
67-
ARG OPEN_ROUTER_API_KEY
68-
ARG GOOGLE_GENERATIVE_AI_API_KEY
69-
ARG OLLAMA_API_BASE_URL
70-
ARG XAI_API_KEY
71-
ARG TOGETHER_API_KEY
72-
ARG TOGETHER_API_BASE_URL
90+
# Non-sensitive development arguments
7391
ARG VITE_LOG_LEVEL=debug
7492
ARG DEFAULT_NUM_CTX
7593

76-
ENV GROQ_API_KEY=${GROQ_API_KEY} \
77-
HuggingFace_API_KEY=${HuggingFace_API_KEY} \
78-
OPENAI_API_KEY=${OPENAI_API_KEY} \
79-
ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} \
80-
OPEN_ROUTER_API_KEY=${OPEN_ROUTER_API_KEY} \
81-
GOOGLE_GENERATIVE_AI_API_KEY=${GOOGLE_GENERATIVE_AI_API_KEY} \
82-
OLLAMA_API_BASE_URL=${OLLAMA_API_BASE_URL} \
83-
XAI_API_KEY=${XAI_API_KEY} \
84-
TOGETHER_API_KEY=${TOGETHER_API_KEY} \
85-
TOGETHER_API_BASE_URL=${TOGETHER_API_BASE_URL} \
86-
AWS_BEDROCK_CONFIG=${AWS_BEDROCK_CONFIG} \
87-
VITE_LOG_LEVEL=${VITE_LOG_LEVEL} \
94+
# Set non-sensitive environment variables for development
95+
ENV VITE_LOG_LEVEL=${VITE_LOG_LEVEL} \
8896
DEFAULT_NUM_CTX=${DEFAULT_NUM_CTX} \
8997
RUNNING_IN_DOCKER=true
9098

99+
# Note: API keys should be provided at runtime via docker run -e or docker-compose
100+
# Example: docker run -e OPENAI_API_KEY=your_key_here ...
101+
91102
RUN mkdir -p /app/run
92103
CMD ["pnpm", "run", "dev", "--host"]

docker-compose.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ services:
3838
app-dev:
3939
image: bolt-ai:development
4040
build:
41-
target: bolt-ai-development
41+
context: .
42+
dockerfile: Dockerfile
43+
target: development
4244
env_file:
4345
- '.env'
4446
- '.env.local'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"dockerstart": "bindings=$(./bindings.sh) && wrangler pages dev ./build/client $bindings --ip 0.0.0.0 --port 5173 --no-show-interactive-dev-session",
2525
"dockerrun": "docker run -it -d --name bolt-ai-live -p 5173:5173 --env-file .env.local bolt-ai",
2626
"dockerbuild:prod": "docker build -t bolt-ai:production -t bolt-ai:latest --target bolt-ai-production .",
27-
"dockerbuild": "docker build -t bolt-ai:development -t bolt-ai:latest --target bolt-ai-development .",
27+
"dockerbuild": "docker build -t bolt-ai:development -t bolt-ai:latest --target development .",
2828
"typecheck": "tsc",
2929
"typegen": "wrangler types",
3030
"preview": "pnpm run build && pnpm run start",

0 commit comments

Comments
 (0)