Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Docker and Docker Compose support #3417

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
.git
.gitignore
Dockerfile
docker-compose.yml
.env
.env.local
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM node:20.15.1
codewithtyler marked this conversation as resolved.
Show resolved Hide resolved

WORKDIR /app

# Install pnpm (matches packageManager in package.json)
RUN npm install -g [email protected]

# Copy package files first
COPY package.json pnpm-lock.yaml ./

# Clean install dependencies with legacy peer deps
RUN rm -rf node_modules
RUN pnpm install --no-frozen-lockfile
RUN pnpm rebuild
codewithtyler marked this conversation as resolved.
Show resolved Hide resolved

# Copy source code
COPY . .

# Create empty .env.local if it doesn't exist
RUN touch .env.local

# Expose Vite's default port
EXPOSE 5173

# Required for WebContainer API
ENV NODE_ENV=development
ENV VITE_LOG_LEVEL=debug

# Start Vite directly instead of through Remix
CMD ["pnpm", "exec", "vite", "dev", "--host"]
28 changes: 28 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
services:
bolt:
container_name: bolt
image: bolt-new
build:
context: .
dockerfile: Dockerfile
ports:
- "5173:5173"
volumes:
- .:/app
- /app/node_modules
environment:
- NODE_ENV=development
- VITE_LOG_LEVEL=debug
env_file:
- .env.local
cap_add:
- SYS_ADMIN
security_opt:
- seccomp=unconfined
command: pnpm exec vite dev --host
networks:
- boltnew

networks:
boltnew:
name: boltnew
5 changes: 5 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ export default defineConfig((config) => {
build: {
target: 'esnext',
},
server: {
host: '0.0.0.0',
strictPort: true,
port: 5173,
},
plugins: [
nodePolyfills({
include: ['path', 'buffer'],
Expand Down
61 changes: 61 additions & 0 deletions vite.config.ts.timestamp-1732907825160-56d5c4969c2cb.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// vite.config.ts
import { cloudflareDevProxyVitePlugin as remixCloudflareDevProxy, vitePlugin as remixVitePlugin } from "file:///app/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected][email protected]_typ_qwyxqdhnwp3srgtibfrlais3ge/node_modules/@remix-run/dev/dist/index.js";
import UnoCSS from "file:///app/node_modules/.pnpm/[email protected][email protected][email protected][email protected]_@[email protected][email protected]_/node_modules/unocss/dist/vite.mjs";
import { defineConfig } from "file:///app/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/index.js";
import { nodePolyfills } from "file:///app/node_modules/.pnpm/[email protected][email protected][email protected]_@[email protected][email protected]_/node_modules/vite-plugin-node-polyfills/dist/index.js";
import { optimizeCssModules } from "file:///app/node_modules/.pnpm/[email protected][email protected]_@[email protected][email protected]_/node_modules/vite-plugin-optimize-css-modules/dist/index.mjs";
import tsconfigPaths from "file:///app/node_modules/.pnpm/[email protected][email protected][email protected]_@[email protected][email protected]_/node_modules/vite-tsconfig-paths/dist/index.mjs";
var vite_config_default = defineConfig((config) => {
return {
build: {
target: "esnext"
},
server: {
host: "0.0.0.0",
strictPort: true,
port: 5173
},
plugins: [
nodePolyfills({
include: ["path", "buffer"]
}),
config.mode !== "test" && remixCloudflareDevProxy(),
remixVitePlugin({
future: {
v3_fetcherPersist: true,
v3_relativeSplatPath: true,
v3_throwAbortReason: true
}
}),
UnoCSS(),
tsconfigPaths(),
chrome129IssuePlugin(),
config.mode === "production" && optimizeCssModules({ apply: "build" })
]
};
});
function chrome129IssuePlugin() {
return {
name: "chrome129IssuePlugin",
configureServer(server) {
server.middlewares.use((req, res, next) => {
const raw = req.headers["user-agent"]?.match(/Chrom(e|ium)\/([0-9]+)\./);
if (raw) {
const version = parseInt(raw[2], 10);
if (version === 129) {
res.setHeader("content-type", "text/html");
res.end(
'<body><h1>Please use Chrome Canary for testing.</h1><p>Chrome 129 has an issue with JavaScript modules & Vite local development, see <a href="https://github.com/stackblitz/bolt.new/issues/86#issuecomment-2395519258">for more information.</a></p><p><b>Note:</b> This only impacts <u>local development</u>. `pnpm run build` and `pnpm run start` will work fine in this browser.</p></body>'
);
return;
}
}
next();
});
}
};
}
export {
vite_config_default as default
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCIvYXBwXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ZpbGVuYW1lID0gXCIvYXBwL3ZpdGUuY29uZmlnLnRzXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ltcG9ydF9tZXRhX3VybCA9IFwiZmlsZTovLy9hcHAvdml0ZS5jb25maWcudHNcIjtpbXBvcnQgeyBjbG91ZGZsYXJlRGV2UHJveHlWaXRlUGx1Z2luIGFzIHJlbWl4Q2xvdWRmbGFyZURldlByb3h5LCB2aXRlUGx1Z2luIGFzIHJlbWl4Vml0ZVBsdWdpbiB9IGZyb20gJ0ByZW1peC1ydW4vZGV2JztcbmltcG9ydCBVbm9DU1MgZnJvbSAndW5vY3NzL3ZpdGUnO1xuaW1wb3J0IHsgZGVmaW5lQ29uZmlnLCB0eXBlIFZpdGVEZXZTZXJ2ZXIgfSBmcm9tICd2aXRlJztcbmltcG9ydCB7IG5vZGVQb2x5ZmlsbHMgfSBmcm9tICd2aXRlLXBsdWdpb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