feat: Add addditional Dockerfile.cn and compose.cn.yml #1

Open
fly6516 wants to merge 4 commits from Dockerfile.CN into main
2 changed files with 11 additions and 8 deletions
Showing only changes of commit f1ead3ae6c - Show all commits

View File

@ -1,5 +1,5 @@
# syntax=docker.io/docker/dockerfile:1
FROM node:22-alpine AS base
FROM dockerp.com/node:22-alpine AS base
FROM base AS deps
RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirror.nju.edu.cn/alpine#g' /etc/apk/repositories && \
@ -10,21 +10,22 @@ COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* bun.lock* .npmrc
# 统一配置所有包管理器使用淘宝源
RUN \
npm config set registry https://registry.npmmirror.com && \
if [ -f yarn.lock ]; then \
yarn config set registry https://registry.npmmirror.com && \
# yarn config set registry https://registry.npmmirror.com && \
yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then \
npm ci --registry=https://registry.npmmirror.com; \
elif [ -f pnpm-lock.yaml ]; then \
corepack enable pnpm && \
pnpm config set registry https://registry.npmmirror.com && \
# pnpm config set registry https://registry.npmmirror.com && \
pnpm i --frozen-lockfile; \
elif [ -f bun.lock ]; then \
sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirror.nju.edu.cn/alpine#g' /etc/apk/repositories && \
apk add --no-cache curl bash && \
curl -fsSL https://bun.sh/install | bash && \
npm install -g bun && \
export BUN_INSTALL="$HOME/.bun" && \
export PATH="$BUN_INSTALL/bin:$PATH" && \
bun config set registry https://registry.npmmirror.com && \
bun install --frozen-lockfile; \
else echo "Lockfile not found." && exit 1; \
fi
@ -38,12 +39,14 @@ ENV NEXT_TELEMETRY_DISABLED=1
# 合并构建命令
RUN \
npm config set registry https://registry.npmmirror.com && \
if [ -f yarn.lock ]; then yarn run build; \
elif [ -f package-lock.json ]; then npm run build; \
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
elif [ -f bun.lock ]; then \
sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirror.nju.edu.cn/alpine#g' /etc/apk/repositories && \
apk add --no-cache curl bash && \
curl -fsSL https://bun.sh/install | bash && \
npm install -g bun && \
export BUN_INSTALL="$HOME/.bun" && \
export PATH="$BUN_INSTALL/bin:$PATH" && \
bun run build; \

View File

@ -1,4 +1,4 @@
FROM alpine:latest AS builder
FROM dockerp.com/alpine:latest AS builder
RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirror.nju.edu.cn/alpine#g' /etc/apk/repositories&& \
apk add --no-cache git npm
@ -17,7 +17,7 @@ COPY servers.yml .
# 合并命令减少镜像层
RUN npm install --registry=https://repo.nju.edu.cn/repository/npm/ && npm run prepare
FROM alpine:latest
FROM dockerp.com/alpine:latest
RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirror.nju.edu.cn/alpine#g' /etc/apk/repositories&& \
apk add --no-cache build-base clang-extra-tools nodejs