Files
AI-Testing/frontend/Dockerfile
2026-04-12 20:18:09 +08:00

21 lines
765 B
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.
# 基础镜像来自 Docker Hub请在本机配置阿里云镜像加速器后再构建见仓库 docker-compose.yml 注释)
FROM node:22-alpine AS builder
WORKDIR /app
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
COPY package.json /app/package.json
# 阿里云镜像站指定的 npm 同步源(原淘宝镜像域名已迁移至 npmmirror
RUN npm config set registry https://registry.npmmirror.com && npm install
COPY . /app
RUN npm run build \
&& test -f /app/dist/index.html \
&& ls -la /app/dist
FROM nginx:1.27-alpine
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80