Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +17 -15
Dockerfile
CHANGED
|
@@ -1,34 +1,36 @@
|
|
| 1 |
-
# Use Node
|
| 2 |
-
FROM node:20-slim
|
| 3 |
|
| 4 |
-
# Install git
|
| 5 |
-
RUN apt-get update && apt-get install -y git
|
| 6 |
|
| 7 |
-
# Install pnpm
|
| 8 |
RUN npm install -g pnpm
|
| 9 |
|
| 10 |
-
# Set the working directory
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
-
# Clone the
|
| 14 |
-
# We clone into the current directory (.)
|
| 15 |
RUN git clone https://github.com/tyrellshawn/bolt.diy.git .
|
| 16 |
|
| 17 |
-
# Create
|
| 18 |
-
# You must set actual API keys in Hugging Face "Settings" -> "Variables/Secrets"
|
| 19 |
RUN cp .env.example .env.local
|
| 20 |
|
| 21 |
# Install dependencies
|
| 22 |
RUN pnpm install
|
| 23 |
|
| 24 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
RUN pnpm run build
|
| 26 |
|
| 27 |
-
# Expose
|
| 28 |
ENV PORT=7860
|
| 29 |
EXPOSE 7860
|
| 30 |
|
| 31 |
-
# Start the application
|
| 32 |
-
# We
|
| 33 |
-
# We pass flags to ensure it binds to the correct host and port for HF
|
| 34 |
CMD ["pnpm", "run", "start", "--", "--port", "7860", "--host", "0.0.0.0"]
|
|
|
|
| 1 |
+
# Use Node 20 (Bullseye is more compatible than Slim for some build tools)
|
| 2 |
+
FROM node:20-bullseye-slim
|
| 3 |
|
| 4 |
+
# Install git and python3 (often needed for native module builds)
|
| 5 |
+
RUN apt-get update && apt-get install -y git python3 make g++ && rm -rf /var/lib/apt/lists/*
|
| 6 |
|
| 7 |
+
# Install pnpm
|
| 8 |
RUN npm install -g pnpm
|
| 9 |
|
|
|
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
+
# Clone the repository
|
|
|
|
| 13 |
RUN git clone https://github.com/tyrellshawn/bolt.diy.git .
|
| 14 |
|
| 15 |
+
# Create env file
|
|
|
|
| 16 |
RUN cp .env.example .env.local
|
| 17 |
|
| 18 |
# Install dependencies
|
| 19 |
RUN pnpm install
|
| 20 |
|
| 21 |
+
# --- FIX: PATCH VITE CONFIG ---
|
| 22 |
+
# The Cloudflare proxy plugin crashes in restricted Docker environments (like HF Spaces)
|
| 23 |
+
# during the build. We remove it from vite.config.ts because it's only needed for dev.
|
| 24 |
+
# We use sed to delete any lines containing 'cloudflareDevProxyVitePlugin'
|
| 25 |
+
RUN sed -i '/cloudflareDevProxyVitePlugin/d' vite.config.ts
|
| 26 |
+
|
| 27 |
+
# Build the project (This should now succeed without starting Miniflare)
|
| 28 |
RUN pnpm run build
|
| 29 |
|
| 30 |
+
# Expose port 7860 for Hugging Face
|
| 31 |
ENV PORT=7860
|
| 32 |
EXPOSE 7860
|
| 33 |
|
| 34 |
+
# Start the application using Wrangler
|
| 35 |
+
# We bind to 0.0.0.0 to ensure HF can route traffic to it
|
|
|
|
| 36 |
CMD ["pnpm", "run", "start", "--", "--port", "7860", "--host", "0.0.0.0"]
|