mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +00:00
fix: use origin method to compile
This commit is contained in:
parent
17160193d6
commit
eb4da92d13
@ -1,10 +1,6 @@
|
||||
# syntax=docker.io/docker/dockerfile:1
|
||||
FROM node:22-alpine AS base
|
||||
|
||||
# 全局配置淘宝镜像源
|
||||
RUN npm config set registry https://registry.npmmirror.com && \
|
||||
sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirror.nju.edu.cn/alpine#g' /etc/apk/repositories
|
||||
|
||||
FROM base AS deps
|
||||
RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirror.nju.edu.cn/alpine#g' /etc/apk/repositories && \
|
||||
apk add --no-cache libc6-compat
|
||||
@ -14,7 +10,6 @@ COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* bun.lock* .npmrc
|
||||
|
||||
# 统一配置所有包管理器使用淘宝源
|
||||
RUN \
|
||||
echo "开始安装依赖..." && \
|
||||
if [ -f yarn.lock ]; then \
|
||||
yarn config set registry https://registry.npmmirror.com && \
|
||||
yarn --frozen-lockfile; \
|
||||
@ -45,17 +40,21 @@ ENV NEXT_TELEMETRY_DISABLED=1
|
||||
RUN \
|
||||
if [ -f yarn.lock ]; then yarn run build; \
|
||||
elif [ -f package-lock.json ]; then npm run build; \
|
||||
elif [ -f pnpm-lock.yaml ]; then pnpm run build; \
|
||||
elif [ -f bun.lock ]; then bun run build; \
|
||||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
|
||||
elif [ -f bun.lock ]; then \
|
||||
apk add --no-cache curl bash && \
|
||||
curl -fsSL https://bun.sh/install | bash && \
|
||||
export BUN_INSTALL="$HOME/.bun" && \
|
||||
export PATH="$BUN_INSTALL/bin:$PATH" && \
|
||||
bun run build; \
|
||||
else echo "Lockfile not found." && exit 1; \
|
||||
fi
|
||||
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
|
||||
RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirror.nju.edu.cn/alpine#g' /etc/apk/repositories && \
|
||||
apk add --no-cache curl && \
|
||||
addgroup --system --gid 1001 nodejs && \
|
||||
adduser --system --uid 1001 nextjs
|
||||
apk add --no-cache curl
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
Loading…
Reference in New Issue
Block a user