Files
market_page/frontend/Dockerfile
jeremygan2021 a14c2b6240 gunicorn
2026-02-10 22:06:07 +08:00

27 lines
594 B
Docker

# Use an official Node runtime as a parent image
FROM node:22-alpine
# Set working directory
WORKDIR /app
# Install dependencies
COPY package.json package-lock.json* ./
RUN npm install --registry=https://registry.npmmirror.com
# 复制项目文件
COPY . .
# 接收构建参数
ARG VITE_API_URL=http://localhost:8000/api
# 设置环境变量供构建时使用
ENV VITE_API_URL=$VITE_API_URL
# 构建生产环境代码
RUN npm run build
# 暴露应用运行的端口
EXPOSE 15173
# 启动应用 (Preview 模式)
CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "15173"]