Files
sillytavern-repalice/docker/frontend.Dockerfile
2026-04-26 03:34:47 +08:00

39 lines
1.1 KiB
Docker

# Frontend Dockerfile - Vue3 + Vite
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files and npm config
COPY client/package*.json ./client/
COPY client/.npmrc ./client/
COPY shared/package*.json ./shared/
# Install dependencies with multiple mirror fallback
RUN cd client && \
echo "Trying Aliyun mirror for frontend..." && \
npm install --registry=https://registry.npmmirror.com --prefer-offline --no-audit --no-fund || \
(echo "Aliyun failed, trying Tencent Cloud..." && \
npm install --registry=https://mirrors.cloud.tencent.com/npm/ --prefer-offline --no-audit --no-fund) || \
(echo "Tencent failed, trying Huawei Cloud..." && \
npm install --registry=https://repo.huaweicloud.com/repository/npm/ --prefer-offline --no-audit --no-fund)
# Copy source code
COPY client ./client
COPY shared ./shared
# Build
RUN cd client && npm run build
# Production stage - serve with nginx
FROM nginx:alpine
# Copy custom nginx config
COPY docker/nginx/default.conf /etc/nginx/conf.d/default.conf
# Copy built files
COPY --from=builder /app/client/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]