Files
Scoring-System/frontend/Dockerfile
爽哒哒 f26d35da66
All checks were successful
Deploy to Server / deploy (push) Successful in 18s
创赢未来评分系统 - 初始化提交(移除大文件)
2026-03-18 22:41:23 +08:00

30 lines
702 B
Docker

# Use an official Node runtime as a parent image
FROM node:22-alpine
# Set working directory
WORKDIR /app
# Install build dependencies for native modules
RUN apk add --no-cache autoconf automake libtool make g++ zlib-dev nasm python3
# Install dependencies
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 15173
# 启动应用 (Preview 模式)
CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "15173"]