Compare commits
2 Commits
e0822528a7
...
ddc9e613e2
| Author | SHA1 | Date | |
|---|---|---|---|
| ddc9e613e2 | |||
| 93688a0e4e |
4
apps/.dockerignore
Normal file
4
apps/.dockerignore
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
node_modules
|
||||||
|
.next
|
||||||
|
.git
|
||||||
|
.env.local
|
||||||
@@ -8,14 +8,16 @@ RUN pnpm install --frozen-lockfile
|
|||||||
COPY . .
|
COPY . .
|
||||||
RUN pnpm run build
|
RUN pnpm run build
|
||||||
|
|
||||||
FROM node:22-alpine
|
RUN CI=true pnpm prune --prod
|
||||||
RUN npm install -g pnpm
|
|
||||||
|
FROM node:22-alpine AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package.json pnpm-lock.yaml ./
|
ENV NODE_ENV=production
|
||||||
RUN pnpm install --frozen-lockfile --prod
|
|
||||||
|
|
||||||
|
COPY --from=builder /app/node_modules ./node_modules
|
||||||
COPY --from=builder /app/dist ./dist
|
COPY --from=builder /app/dist ./dist
|
||||||
|
COPY --from=builder /app/package.json ./package.json
|
||||||
|
|
||||||
EXPOSE 3001
|
EXPOSE 3001
|
||||||
CMD ["node", "dist/main.js"]
|
CMD ["node", "dist/main.js"]
|
||||||
@@ -1,28 +1,33 @@
|
|||||||
FROM node:22-alpine AS builder
|
# 安装依赖
|
||||||
|
FROM node:22-alpine AS deps
|
||||||
RUN npm install -g pnpm
|
RUN apk add --no-cache libc6-compat
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
COPY package*.json pnpm-lock.yaml ./
|
|
||||||
RUN pnpm install --frozen-lockfile
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
ARG API_BASE
|
|
||||||
ENV API_BASE=$API_BASE
|
|
||||||
|
|
||||||
RUN pnpm run build
|
|
||||||
|
|
||||||
FROM node:22-alpine
|
|
||||||
RUN npm install -g pnpm
|
RUN npm install -g pnpm
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json pnpm-lock.yaml ./
|
COPY package.json pnpm-lock.yaml ./
|
||||||
RUN pnpm install --frozen-lockfile --prod
|
RUN pnpm install --frozen-lockfile
|
||||||
COPY --from=builder /app/.next ./.next
|
|
||||||
COPY --from=builder /app/public ./public
|
|
||||||
COPY --from=builder /app/next.config.ts ./
|
|
||||||
|
|
||||||
|
# 编译
|
||||||
|
FROM node:22-alpine AS builder
|
||||||
|
RUN npm install -g pnpm
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
COPY . .
|
||||||
|
ARG API_BASE
|
||||||
|
ENV API_BASE=$API_BASE
|
||||||
|
RUN pnpm run build
|
||||||
|
|
||||||
|
# 运行
|
||||||
|
FROM node:22-alpine AS runner
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV NODE_ENV=production
|
||||||
ARG API_BASE
|
ARG API_BASE
|
||||||
ENV API_BASE=$API_BASE
|
ENV API_BASE=$API_BASE
|
||||||
|
|
||||||
|
COPY --from=builder /app/.next/standalone ./
|
||||||
|
COPY --from=builder /app/.next/static ./.next/static
|
||||||
|
COPY --from=builder /app/public ./public
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
CMD ["pnpm", "start"]
|
|
||||||
|
CMD ["node", "server.js"]
|
||||||
@@ -2,6 +2,7 @@ import type { NextConfig } from "next";
|
|||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
/* config options here */
|
/* config options here */
|
||||||
|
output: 'standalone',
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
devIndicators: {
|
devIndicators: {
|
||||||
position: 'bottom-right',
|
position: 'bottom-right',
|
||||||
@@ -16,7 +17,7 @@ const nextConfig: NextConfig = {
|
|||||||
},
|
},
|
||||||
images: {
|
images: {
|
||||||
remotePatterns: [new URL('https://tone-personal.oss-cn-chengdu.aliyuncs.com/**')]
|
remotePatterns: [new URL('https://tone-personal.oss-cn-chengdu.aliyuncs.com/**')]
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
export default nextConfig;
|
||||||
|
|||||||
Reference in New Issue
Block a user