mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
58 lines
1.4 KiB
Docker
58 lines
1.4 KiB
Docker
FROM node:18-alpine AS base
|
|
|
|
FROM base AS deps
|
|
RUN apk add --no-cache libc6-compat
|
|
WORKDIR /app
|
|
|
|
# Install glibc to run Bun
|
|
RUN if [[ $(uname -m) == "aarch64" ]] ; \
|
|
then \
|
|
# aarch64
|
|
wget https://raw.githubusercontent.com/squishyu/alpine-pkg-glibc-aarch64-bin/master/glibc-2.26-r1.apk ; \
|
|
apk add --no-cache --allow-untrusted --force-overwrite glibc-2.26-r1.apk ; \
|
|
rm glibc-2.26-r1.apk ; \
|
|
else \
|
|
# x86_64
|
|
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.28-r0/glibc-2.28-r0.apk ; \
|
|
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub ; \
|
|
apk add --no-cache --force-overwrite glibc-2.28-r0.apk ; \
|
|
rm glibc-2.28-r0.apk ; \
|
|
fi
|
|
|
|
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* bun.lockb* ./
|
|
RUN npm install -g bun && bun install
|
|
|
|
|
|
FROM base AS builder
|
|
WORKDIR /app
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
|
|
|
|
RUN yarn build
|
|
|
|
|
|
FROM base AS runner
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV production
|
|
ENV NEXT_TELEMETRY_DISABLED 1
|
|
|
|
RUN addgroup --system --gid 1001 nodejs
|
|
RUN adduser --system --uid 1001 nextjs
|
|
|
|
COPY --from=builder /app/public ./public
|
|
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.env.example ./.env
|
|
|
|
USER nextjs
|
|
|
|
EXPOSE 3000
|
|
|
|
ENV PORT 3000
|
|
ENV HOSTNAME "0.0.0.0"
|
|
|
|
CMD ["node", "server.js"]
|