opensite / Dockerfile
luoluoluo22's picture
修复: 解决Feature-Policy警告和页面显示问题
78963e3
raw
history blame contribute delete
516 Bytes
# Dockerfile
FROM node:18
# 设置工作目录
WORKDIR /code
# 复制依赖文件
COPY package.json package-lock.json ./
# 安装依赖
RUN npm install
# 复制源代码
COPY . .
# 构建应用
RUN npm run build
# 确保 dist 目录中有 index.html(如果构建失败)
RUN mkdir -p dist && \
if [ ! -f "dist/index.html" ]; then \
echo "使用备用 index.html"; \
cp index.html dist/ || echo "备用 index.html 不存在"; \
fi
# 暴露端口
EXPOSE 7860
# 启动命令
CMD ["node", "server.js"]