Files
knowai/Dockerfile
2025-11-27 11:50:12 +08:00

71 lines
2.3 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ------------------------------------------------
# 基础镜像Node LTSDebian trixie-slim
# ------------------------------------------------
FROM node:lts-trixie-slim
WORKDIR /usr/src/app
# 指定全局路径以及
ENV PNPM_HOME=/pnpm-global
ENV PATH=$PNPM_HOME:$PATH
ENV SHELL=/bin/sh
# ------------------------------------------------
# 安装 pnpm 并配置国内源
# ------------------------------------------------
RUN npm install -g pnpm && \
pnpm config set registry https://registry.npmmirror.com
# 在 Dockerfile 里替换源
RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian trixie main contrib non-free" > /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian-security trixie-security main contrib non-free" >> /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian trixie-updates main contrib non-free" >> /etc/apt/sources.list
# ------------------------------------------------
# 更新系统工具(最小化依赖)
# ------------------------------------------------
RUN apt-get update && apt-get install -y --no-install-recommends \
git curl ca-certificates && \
rm -rf /var/lib/apt/lists/*
# ------------------------------------------------
# 安装运行时核心依赖(支持 SSR + CSR
# ------------------------------------------------
RUN pnpm add -g \
nuxt@latest \
vue@latest \
vue-router@latest \
@vueuse/core \
@pinia/nuxt \
pinia-plugin-persistedstate \
@element-plus/nuxt \
@element-plus/icons-vue \
@nuxtjs/tailwindcss \
@nuxt/image \
@nuxt/icon \
@nuxtjs/color-mode \
@nuxtjs/component-cache \
axios \
node-fetch \
socket.io-client \
lodash \
dayjs \
crypto-js
# ------------------------------------------------
# 版本验证
# ------------------------------------------------
RUN echo "✅ Node 版本:" && node -v && \
echo "✅ pnpm 版本:" && pnpm -v && \
echo "✅ Nuxt 版本:" && pnpm dlx nuxt --version || true
# ------------------------------------------------
# 默认端口
# ------------------------------------------------
EXPOSE 3000
# ------------------------------------------------
# 启动方式
# ------------------------------------------------
CMD ["bash"]