This commit is contained in:
xiaoma
2026-02-10 21:40:05 +08:00
parent 5948e2998d
commit ee88c5b3e1
7 changed files with 28 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
# Use an official Node runtime as a parent image
FROM node:18-alpine
FROM node:22-alpine
# Set working directory
WORKDIR /app
@@ -8,11 +8,17 @@ WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install
# Copy project files
# 复制项目文件
COPY . .
# Expose the port the app runs on
EXPOSE 5173
# 设置环境变量供构建时使用
ENV VITE_API_URL=http://localhost:8000/api
# Start the application
CMD ["npm", "run", "dev", "--", "--host"]
# 构建生产环境代码
RUN npm run build
# 暴露应用运行的端口
EXPOSE 15173
# 启动应用 (Preview 模式)
CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "15173"]

View File

@@ -1,7 +1,16 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
//123
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
server: {
host: '0.0.0.0',
port: 5173,
},
preview: {
host: '0.0.0.0',
port: 15173,
}
})