This commit is contained in:
28
frontend/Dockerfile
Normal file
28
frontend/Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
||||
# 使用 Node 运行 preview 模式(和 market_page 一致)
|
||||
FROM node:22-alpine
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 安装构建依赖
|
||||
RUN apk add --no-cache autoconf automake libtool make g++ zlib-dev nasm python3
|
||||
|
||||
# 安装依赖
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm install --registry=https://registry.npmmirror.com
|
||||
|
||||
# 复制项目文件
|
||||
COPY . .
|
||||
|
||||
# 接收构建参数
|
||||
ARG VITE_API_URL=/api
|
||||
ENV VITE_API_URL=$VITE_API_URL
|
||||
|
||||
# 构建生产环境代码
|
||||
RUN npm run build
|
||||
|
||||
# 暴露应用运行的端口
|
||||
EXPOSE 8890
|
||||
|
||||
# 启动应用 (Preview 模式)
|
||||
CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "8890"]
|
||||
Reference in New Issue
Block a user