Skip to content

Commit dab7f28

Browse files
committed
for docker
1 parent 38e4233 commit dab7f28

File tree

2 files changed

+76
-33
lines changed

2 files changed

+76
-33
lines changed

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM node:24
2+
3+
# Create and set the working directory
4+
WORKDIR /app
5+
6+
# Copy all files to the container
7+
COPY . .
8+
9+
# Install dependencies
10+
RUN npm install
11+
12+
RUN npm run build
13+
14+
# Expose the port the app runs on
15+
EXPOSE 3000
16+
17+
# Start the application
18+
CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "3000"]

vite.config.ts

Lines changed: 58 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,65 @@
1+
// vite.config.ts
2+
3+
/// <reference types="vitest" />
4+
15
import tailwindcss from '@tailwindcss/vite';
26
import { svelteTesting } from '@testing-library/svelte/vite';
37
import { sveltekit } from '@sveltejs/kit/vite';
48
import { defineConfig } from 'vite';
59

6-
export default defineConfig({
7-
plugins: [tailwindcss(), sveltekit()],
8-
optimizeDeps: {
9-
exclude: ['clsx', '@xyflow/system', 'classcat']
10-
},
11-
server: {
12-
host: '0.0.0.0',
13-
port: 3000
14-
},
15-
test: {
16-
workspace: [
17-
{
18-
extends: './vite.config.ts',
19-
plugins: [svelteTesting()],
20-
test: {
21-
name: 'client',
22-
environment: 'jsdom',
23-
clearMocks: true,
24-
include: ['src/**/*.svelte.{test,spec}.{js,ts}'],
25-
exclude: ['src/lib/server/**'],
26-
setupFiles: ['./vitest-setup-client.ts']
27-
}
28-
},
29-
{
30-
extends: './vite.config.ts',
31-
test: {
32-
name: 'server',
33-
environment: 'node',
34-
include: ['src/**/*.{test,spec}.{js,ts}'],
35-
exclude: ['src/**/*.svelte.{test,spec}.{js,ts}']
10+
const backendUrls = {
11+
development: 'http://localhost:5000',
12+
production: 'http://yourdomain.com'
13+
} as const;
14+
15+
type BackendUrlMode = keyof typeof backendUrls;
16+
17+
18+
export default defineConfig(({ mode }) => {
19+
const safeMode = mode as BackendUrlMode;
20+
const backendUrl = backendUrls[safeMode] || backendUrls.production;
21+
22+
return {
23+
plugins: [tailwindcss(), sveltekit()],
24+
optimizeDeps: {
25+
exclude: ['clsx', '@xyflow/system', 'classcat']
26+
},
27+
server: {
28+
host: '0.0.0.0',
29+
port: 3000,
30+
allowedHosts: [
31+
'localhost',
32+
'127.0.0.1',
33+
'langgraph-gui.posetmage.com',
34+
],
35+
},
36+
define: {
37+
'import.meta.env.VITE_BACKEND_URL': JSON.stringify(backendUrl)
38+
},
39+
test: {
40+
workspace: [
41+
{
42+
extends: './vite.config.ts',
43+
plugins: [svelteTesting()],
44+
test: {
45+
name: 'client',
46+
environment: 'jsdom',
47+
clearMocks: true,
48+
include: ['src/**/*.svelte.{test,spec}.{js,ts}'],
49+
exclude: ['src/lib/server/**'],
50+
setupFiles: ['./vitest-setup-client.ts']
51+
}
52+
},
53+
{
54+
extends: './vite.config.ts',
55+
test: {
56+
name: 'server',
57+
environment: 'node',
58+
include: ['src/**/*.{test,spec}.{js,ts}'],
59+
exclude: ['src/**/*.svelte.{test,spec}.{js,ts}']
60+
}
3661
}
37-
}
38-
]
62+
]
63+
}
3964
}
40-
});
65+
})

0 commit comments

Comments
 (0)