-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
38 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,46 @@ | ||
FROM node:18-slim AS base | ||
FROM node:18-alpine AS base | ||
|
||
ENV TZ="Asia/Shanghai" | ||
FROM base AS deps | ||
|
||
RUN apk add --no-cache libc6-compat | ||
|
||
WORKDIR /app | ||
|
||
COPY .output /app/.output | ||
COPY package.json pnpm-lock.yaml ./ | ||
|
||
RUN pnpm config set registry 'https://registry.npmmirror.com/' | ||
RUN pnpm i | ||
|
||
FROM base AS builder | ||
|
||
RUN apk update && apk add --no-cache git | ||
|
||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
WORKDIR /app | ||
COPY --from=deps /app/node_modules ./node_modules | ||
COPY . . | ||
COPY ./.env ./ | ||
|
||
RUN pnpm run build | ||
|
||
FROM base AS runner | ||
WORKDIR /app | ||
|
||
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/.env ./.env | ||
|
||
EXPOSE 3000 | ||
|
||
CMD ["node", "/app/.output/server/index.mjs"] | ||
ENV TZ="Asia/Shanghai" | ||
|
||
ENV PORT 3000 | ||
|
||
# server.js is created by next build from the standalone output | ||
# https://nextjs.org/docs/pages/api-reference/next-config-js/output | ||
CMD HOSTNAME="0.0.0.0" node server.js | ||
|
||
MAINTAINER besscroft | ||
MAINTAINER besscroft |