File tree 11 files changed +206
-4
lines changed
11 files changed +206
-4
lines changed Original file line number Diff line number Diff line change
1
+ # 构建阶段
2
+ FROM oven/bun:1 as builder
3
+
4
+ # 安装构建依赖
5
+ RUN apt-get update && apt-get install -y \
6
+ python3 \
7
+ build-essential \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ WORKDIR /app
11
+
12
+ # 复制 package.json 和 lock 文件
13
+ COPY package*.json ./
14
+ COPY bun.lockb ./
15
+
16
+ # 安装依赖
17
+ RUN bun install
18
+
19
+ # 复制源代码
20
+ COPY . .
21
+
22
+ # 构建应用
23
+ RUN bun run build
24
+
25
+ # 运行阶段
26
+ FROM oven/bun:1-slim
27
+
28
+ # 安装 Playwright 依赖
29
+ RUN apt-get update && apt-get install -y \
30
+ python3 \
31
+ libnss3 \
32
+ libnspr4 \
33
+ libatk1.0-0 \
34
+ libatk-bridge2.0-0 \
35
+ libcups2 \
36
+ libdrm2 \
37
+ libxkbcommon0 \
38
+ libxcomposite1 \
39
+ libxdamage1 \
40
+ libxfixes3 \
41
+ libxrandr2 \
42
+ libgbm1 \
43
+ libasound2 \
44
+ && rm -rf /var/lib/apt/lists/*
45
+
46
+ # 安装 Playwright 浏览器
47
+ RUN bunx playwright install
48
+
49
+ WORKDIR /app
50
+
51
+ # 从构建阶段复制构建产物和源代码
52
+ COPY --from=builder /app/.output ./
53
+ COPY --from=builder /app/node_modules ./node_modules
54
+ COPY --from=builder /app/hono ./hono
55
+ COPY start.sh ./
56
+
57
+ # 设置环境变量
58
+ ENV NODE_ENV=production
59
+ ENV NUXT_HOST=0.0.0.0
60
+ ENV NUXT_PORT=3000
61
+ ENV PYTHON=/usr/bin/python3
62
+
63
+ # 设置启动脚本权限
64
+ RUN chmod +x ./start.sh
65
+
66
+ # 暴露端口
67
+ EXPOSE 3000
68
+ EXPOSE 3001
69
+
70
+ # 启动应用
71
+ CMD ["./start.sh" ]
Original file line number Diff line number Diff line change
1
+ # 构建阶段
2
+ FROM oven/bun:1 as builder
3
+
4
+ # 安装构建依赖
5
+ RUN apt-get update && apt-get install -y \
6
+ python3 \
7
+ build-essential \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ WORKDIR /app
11
+
12
+ # 复制 package.json 和 lock 文件
13
+ COPY package*.json ./
14
+ COPY bun.lockb ./
15
+
16
+ # 安装依赖
17
+ RUN bun install
18
+
19
+ # 复制源代码
20
+ COPY . .
21
+
22
+ # 运行阶段
23
+ FROM oven/bun:1-slim
24
+
25
+ # 安装 Playwright 依赖
26
+ RUN apt-get update && apt-get install -y \
27
+ python3 \
28
+ libnss3 \
29
+ libnspr4 \
30
+ libatk1.0-0 \
31
+ libatk-bridge2.0-0 \
32
+ libcups2 \
33
+ libdrm2 \
34
+ libxkbcommon0 \
35
+ libxcomposite1 \
36
+ libxdamage1 \
37
+ libxfixes3 \
38
+ libxrandr2 \
39
+ libgbm1 \
40
+ libasound2 \
41
+ && rm -rf /var/lib/apt/lists/*
42
+
43
+ # 安装 Playwright 浏览器
44
+ RUN bunx playwright install --with-deps
45
+
46
+ WORKDIR /app
47
+
48
+ # 从构建阶段复制必要文件
49
+ COPY --from=builder /app/node_modules ./node_modules
50
+ COPY --from=builder /app/hono ./hono
51
+
52
+ # 设置环境变量
53
+ ENV NODE_ENV=production
54
+ ENV PYTHON=/usr/bin/python3
55
+
56
+ # 暴露端口
57
+ EXPOSE 3001
58
+
59
+ # 启动应用
60
+ CMD ["bun", "./hono/index.ts"]
Original file line number Diff line number Diff line change
1
+ # 构建阶段
2
+ FROM oven/bun:1 as builder
3
+
4
+ # 安装构建依赖
5
+ RUN apt-get update && apt-get install -y \
6
+ python3 \
7
+ build-essential \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ WORKDIR /app
11
+
12
+ # 复制 package.json 和 lock 文件
13
+ COPY package*.json ./
14
+ COPY bun.lockb ./
15
+
16
+ # 安装依赖
17
+ RUN bun install
18
+
19
+ # 复制源代码
20
+ COPY . .
21
+
22
+ # 构建应用
23
+ RUN bun run build
24
+
25
+ # 运行阶段
26
+ FROM oven/bun:1-slim
27
+
28
+ WORKDIR /app
29
+
30
+ # 从构建阶段复制构建产物
31
+ COPY --from=builder /app/.output ./
32
+ COPY --from=builder /app/node_modules ./node_modules
33
+
34
+ # 设置环境变量
35
+ ENV NODE_ENV=production
36
+ ENV NUXT_HOST=0.0.0.0
37
+ ENV NUXT_PORT=3000
38
+
39
+ # 暴露端口
40
+ EXPOSE 3000
41
+
42
+ # 启动应用
43
+ CMD ["bun", "./server/index.mjs"]
Original file line number Diff line number Diff line change
1
+
Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
- import Image from ' nuxt/image'
3
2
import { ref } from ' vue'
4
3
5
4
interface Props {
Original file line number Diff line number Diff line change
1
+ version : ' 3.8'
2
+
3
+ services :
4
+ web :
5
+ build :
6
+ context : .
7
+ dockerfile : Dockerfile.web
8
+ ports :
9
+ - " 3000:3000"
10
+ environment :
11
+ - NODE_ENV=production
12
+ restart : unless-stopped
13
+
14
+ server :
15
+ build :
16
+ context : .
17
+ dockerfile : Dockerfile.server
18
+ ports :
19
+ - " 3001:3001"
20
+ environment :
21
+ - NODE_ENV=production
22
+ restart : unless-stopped
Original file line number Diff line number Diff line change @@ -8,8 +8,7 @@ export default defineNuxtConfig({
8
8
'@nuxt/fonts' ,
9
9
'@nuxt/icon' ,
10
10
'@nuxt/image' ,
11
- '@nuxtjs/tailwindcss' ,
12
- 'dayjs-nuxt' ,
11
+ '@nuxtjs/tailwindcss' , 'dayjs-nuxt' ,
13
12
'@pinia/colada-nuxt' ,
14
13
'nuxt-og-image' ,
15
14
'@nuxtjs/seo' ,
@@ -32,5 +31,8 @@ export default defineNuxtConfig({
32
31
configPath : 'tailwind.config.js' ,
33
32
exposeConfig : false ,
34
33
viewer : true ,
34
+ } ,
35
+ nitro : {
36
+ preset : "bun"
35
37
}
36
38
} )
Original file line number Diff line number Diff line change 38
38
"lucide-vue-next" : " ^0.484.0" ,
39
39
"nuxt" : " ^3.16.1" ,
40
40
"nuxt-og-image" : " 5.1.0" ,
41
+ "ofetch" : " ^1.4.1" ,
41
42
"pinia" : " ^3.0.1" ,
42
43
"pinia-plugin-persistedstate" : " ^4.2.0" ,
43
44
"playwright" : " 1.46.1" ,
Original file line number Diff line number Diff line change @@ -4,6 +4,6 @@ export default defineEventHandler(async event => {
4
4
const url = event . path ;
5
5
console . log ( "🚀 ~ url:" , url )
6
6
if ( url . startsWith ( '/api/proxy' ) ) {
7
- return proxyRequest ( event , `http://localhost :3001${ url } ` ) ;
7
+ return proxyRequest ( event , `http://server :3001${ url } ` ) ;
8
8
}
9
9
} ) ;
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ bun ./server/index.mjs &
3
+ bun ./hono/index.ts
You can’t perform that action at this time.
0 commit comments