Files
bolt-diy/Dockerfile
Stijnus 4eb7140fd3 fix: resolve Docker build syntax errors (#1996) (#1999)
* fix: resolve Docker build syntax errors and merge conflicts

- Fix incomplete ARG HuggingFace declaration to ARG HuggingFace_API_KEY
- Fix invalid WORKDIR variable reference ${WORKDIR}/run to /app/run
- Resolve merge conflicts preserving both runtime and development stages
- Add proper development stage with corrected environment variables
- Ensure both dockerbuild and dockerbuild:prod targets work correctly

Resolves Docker build error: "target stage 'bolt-ai-development' could not be found"

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* ci: add comprehensive Docker build validation to main CI pipeline

- Add docker-validation job to ci.yaml workflow
- Test both runtime (production) and development Docker targets
- Validate docker-compose configuration syntax
- Run on all PRs and pushes to catch Docker build issues early
- Set 15-minute timeout to prevent hanging builds
- Use --no-cache and --progress=plain for reliable validation

This ensures Docker build syntax errors like #1996 are caught in CI
before they reach main branch, preventing deployment failures.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: use modern docker compose command syntax in CI

- Change docker-compose to docker compose (GitHub Actions uses Docker Compose v2)
- Fixes CI failure: docker-compose: command not found
- Ensures docker-compose validation works in GitHub Actions runners

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-16 11:33:51 +02:00

93 lines
2.4 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ---- build stage ----
FROM node:22-bookworm-slim AS build
WORKDIR /app
# CI-friendly env
ENV HUSKY=0
ENV CI=true
# Use pnpm
RUN corepack enable && corepack prepare pnpm@9.15.9 --activate
# 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}
# Install deps efficiently
COPY package.json pnpm-lock.yaml* ./
RUN pnpm fetch
# Copy source and build
COPY . .
# install with dev deps (needed to build)
RUN pnpm install --offline --frozen-lockfile
# Build the Remix app (SSR + client)
RUN NODE_OPTIONS=--max-old-space-size=4096 pnpm run build
# Keep only production deps for runtime
RUN pnpm prune --prod --ignore-scripts
# ---- runtime stage ----
FROM node:22-bookworm-slim AS runtime
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=3000
ENV HOST=0.0.0.0
# Install curl so Coolifys healthcheck works inside the image
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 --from=build /app/build /app/build
COPY --from=build /app/node_modules /app/node_modules
COPY --from=build /app/package.json /app/package.json
EXPOSE 3000
# Healthcheck for Coolify
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=5 \
CMD curl -fsS http://localhost:3000/ || exit 1
# Start the Remix server
CMD ["node", "build/server/index.js"]
# ---- development stage ----
FROM build AS development
# Define 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 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} \
VITE_LOG_LEVEL=${VITE_LOG_LEVEL} \
DEFAULT_NUM_CTX=${DEFAULT_NUM_CTX} \
RUNNING_IN_DOCKER=true
RUN mkdir -p /app/run
CMD ["pnpm", "run", "dev", "--host"]