test pack

This commit is contained in:
sijinhui
2024-05-04 11:48:16 +08:00
parent 51e1fdf366
commit 6a004421fc
6 changed files with 254 additions and 48 deletions

View File

@@ -1,59 +1,60 @@
#FROM registry.cn-hangzhou.aliyuncs.com/sijinhui/node:18-alpine AS base
FROM hub.siji.ci/library/node:20-alpine AS base
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk update && apk add --no-cache git tzdata
RUN apk update && apk add --no-cache git tzdata vips-dev
# 设置时区环境变量
ENV TZ=Asia/Chongqing
# 更新并安装时区工具
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
#FROM base AS deps
#RUN apk add --no-cache libc6-compat g++ make
#
#WORKDIR /app
#
#COPY package.json ./
#
#RUN yarn config set registry 'https://registry.npmmirror.com/'
#RUN yarn config set sharp_binary_host "https://npm.taobao.org/mirrors/sharp"
#RUN yarn config set sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips"
FROM base AS deps
RUN apk add --no-cache libc6-compat g++ make
WORKDIR /app
COPY package.json ./
RUN yarn config set registry 'https://registry.npmmirror.com/'
RUN yarn config set sharp_binary_host "https://npm.taobao.org/mirrors/sharp"
RUN yarn config set sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips"
#RUN # 清理遗留的缓存
#RUN yarn cache clean
#RUN yarn install
#
## 避免下面那个报错
#RUN mkdir -p "/app/node_modules/tiktoken"
#
#FROM base AS builder
#
#ENV OPENAI_API_KEY=""
#ENV GOOGLE_API_KEY=""
#ENV CODE=""
#
#WORKDIR /app
#COPY . .
#COPY --from=deps /app/node_modules ./node_modules
#
#RUN yarn build
#
RUN yarn cache clean
RUN yarn install
FROM base AS builder
ENV OPENAI_API_KEY=""
ENV GOOGLE_API_KEY=""
ENV CODE=""
WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules
# 避免下面那个报错
RUN mkdir -p "/app/node_modules/tiktoken"
RUN mkdir -p "/app/node_modules/sharp"
RUN yarn build
FROM base AS runner
WORKDIR /app
#
#RUN apk add proxychains-ng
#
#ENV PROXY_URL=""
#ENV OPENAI_API_KEY=""
#ENV GOOGLE_API_KEY=""
#ENV CODE=""
#
#COPY --from=builder /app/public ./public
#COPY --from=builder /app/.next/standalone ./
#COPY --from=builder /app/.next/static ./.next/static
#COPY --from=builder /app/.next/server ./.next/server
#
## 一个插件一直有问题。
#COPY --from=deps /app/node_modules/tiktoken ./node_modules/tiktoken
COPY out/ .
RUN apk add proxychains-ng
ENV PROXY_URL=""
ENV OPENAI_API_KEY=""
ENV GOOGLE_API_KEY=""
ENV CODE=""
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/.next/server ./.next/server
# 一个插件一直有问题。
COPY --from=builder /app/node_modules/tiktoken ./node_modules/tiktoken
COPY --from=builder /app/node_modules/sharp ./node_modules/sharp
#COPY out/ .
RUN rm -f .env