mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 15:26:33 +00:00
feat: update Dockerfile.cn for avoid docker pull error
This commit is contained in:
parent
4cd8478ccd
commit
f1ead3ae6c
@ -1,5 +1,5 @@
|
|||||||
# syntax=docker.io/docker/dockerfile:1
|
# syntax=docker.io/docker/dockerfile:1
|
||||||
FROM node:22-alpine AS base
|
FROM dockerp.com/node:22-alpine AS base
|
||||||
|
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirror.nju.edu.cn/alpine#g' /etc/apk/repositories && \
|
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 \
|
RUN \
|
||||||
|
npm config set registry https://registry.npmmirror.com && \
|
||||||
if [ -f yarn.lock ]; then \
|
if [ -f yarn.lock ]; then \
|
||||||
yarn config set registry https://registry.npmmirror.com && \
|
# yarn config set registry https://registry.npmmirror.com && \
|
||||||
yarn --frozen-lockfile; \
|
yarn --frozen-lockfile; \
|
||||||
elif [ -f package-lock.json ]; then \
|
elif [ -f package-lock.json ]; then \
|
||||||
npm ci --registry=https://registry.npmmirror.com; \
|
npm ci --registry=https://registry.npmmirror.com; \
|
||||||
elif [ -f pnpm-lock.yaml ]; then \
|
elif [ -f pnpm-lock.yaml ]; then \
|
||||||
corepack enable pnpm && \
|
corepack enable pnpm && \
|
||||||
pnpm config set registry https://registry.npmmirror.com && \
|
# pnpm config set registry https://registry.npmmirror.com && \
|
||||||
pnpm i --frozen-lockfile; \
|
pnpm i --frozen-lockfile; \
|
||||||
elif [ -f bun.lock ]; then \
|
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 && \
|
apk add --no-cache curl bash && \
|
||||||
curl -fsSL https://bun.sh/install | bash && \
|
npm install -g bun && \
|
||||||
export BUN_INSTALL="$HOME/.bun" && \
|
export BUN_INSTALL="$HOME/.bun" && \
|
||||||
export PATH="$BUN_INSTALL/bin:$PATH" && \
|
export PATH="$BUN_INSTALL/bin:$PATH" && \
|
||||||
bun config set registry https://registry.npmmirror.com && \
|
|
||||||
bun install --frozen-lockfile; \
|
bun install --frozen-lockfile; \
|
||||||
else echo "Lockfile not found." && exit 1; \
|
else echo "Lockfile not found." && exit 1; \
|
||||||
fi
|
fi
|
||||||
@ -38,12 +39,14 @@ ENV NEXT_TELEMETRY_DISABLED=1
|
|||||||
|
|
||||||
# 合并构建命令
|
# 合并构建命令
|
||||||
RUN \
|
RUN \
|
||||||
|
npm config set registry https://registry.npmmirror.com && \
|
||||||
if [ -f yarn.lock ]; then yarn run build; \
|
if [ -f yarn.lock ]; then yarn run build; \
|
||||||
elif [ -f package-lock.json ]; then npm 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 pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
|
||||||
elif [ -f bun.lock ]; then \
|
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 && \
|
apk add --no-cache curl bash && \
|
||||||
curl -fsSL https://bun.sh/install | bash && \
|
npm install -g bun && \
|
||||||
export BUN_INSTALL="$HOME/.bun" && \
|
export BUN_INSTALL="$HOME/.bun" && \
|
||||||
export PATH="$BUN_INSTALL/bin:$PATH" && \
|
export PATH="$BUN_INSTALL/bin:$PATH" && \
|
||||||
bun run build; \
|
bun run build; \
|
||||||
|
@ -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&& \
|
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
|
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
|
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&& \
|
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
|
apk add --no-cache build-base clang-extra-tools nodejs
|
||||||
|
Loading…
Reference in New Issue
Block a user