Dockerfile 628 B

123456789101112131415161718192021222324252627282930313233
  1. # 基于 Debian 最新版本
  2. FROM debian:stable-slim
  3. # 安装必要的工具和依赖
  4. RUN apt-get update && apt-get install -y \
  5. curl \
  6. git \
  7. build-essential \
  8. libssl-dev \
  9. && apt-get clean \
  10. && rm -rf /var/lib/apt/lists/*
  11. # 安装 Node.js 和 npm
  12. RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - \
  13. && apt-get install -y nodejs
  14. # 创建工作目录
  15. WORKDIR /app
  16. # 复制项目文件到容器中
  17. COPY . /app
  18. # 安装 Vue 项目依赖
  19. RUN npm install
  20. # 构建 Vue 项目
  21. RUN npm run build
  22. # 暴露默认的 Vue 项目端口
  23. EXPOSE 8080
  24. # 启动 Vue 应用
  25. CMD ["npm", "run", "serve"]