From 254a3c2d1a5b0b9fe075a6f69068a002aabe08a8 Mon Sep 17 00:00:00 2001 From: dragonite-lee Date: Thu, 22 Aug 2024 22:37:50 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20standalone=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/admin/Dockerfile | 12 ++++++------ apps/admin/next.config.js | 1 + apps/user/Dockerfile | 11 +++++------ apps/user/next.config.js | 1 + 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/apps/admin/Dockerfile b/apps/admin/Dockerfile index 8ef9a6d2..ed7863d2 100644 --- a/apps/admin/Dockerfile +++ b/apps/admin/Dockerfile @@ -6,7 +6,7 @@ RUN apk add --no-cache bash curl RUN npm i -g npm RUN corepack enable && corepack prepare yarn@stable --activate -COPY . . +COPY package.json yarn.lock ./ RUN yarn install --frozen-lockfile FROM node:20-alpine AS builder @@ -18,12 +18,12 @@ RUN yarn build --filter=admin FROM node:20-alpine AS runner WORKDIR /app -COPY --from=builder /app/apps/admin/.next ./.next +COPY --from=builder /app/apps/admin/.next/standalone ./ +COPY --from=builder /app/apps/admin/.next/static ./.next/static COPY --from=builder /app/apps/admin/public ./public -COPY --from=builder /app/apps/admin/package.json ./package.json -COPY --from=builder /app/packages ./packages COPY --from=builder /app/apps/admin/next.config.js ./next.config.js -COPY --from=builder /app/node_modules ./node_modules + +ENV PORT=3001 EXPOSE 3001 -CMD ["yarn", "start", "--port", "3001"] +CMD ["node", "server.js"] diff --git a/apps/admin/next.config.js b/apps/admin/next.config.js index 0a081d38..34e1d4bd 100644 --- a/apps/admin/next.config.js +++ b/apps/admin/next.config.js @@ -2,6 +2,7 @@ module.exports = { basePath: '/admin', assetPrefix: '/admin/', + output: 'standalone', reactStrictMode: true, transpilePackages: ['@jeiltodo/ui'], eslint: { diff --git a/apps/user/Dockerfile b/apps/user/Dockerfile index 82a5e253..e08a9b2c 100644 --- a/apps/user/Dockerfile +++ b/apps/user/Dockerfile @@ -6,23 +6,22 @@ RUN apk add --no-cache bash curl RUN npm i -g npm RUN corepack enable && corepack prepare yarn@stable --activate -COPY . . +COPY package.json yarn.lock ./ RUN yarn install --frozen-lockfile FROM node:20-alpine AS builder WORKDIR /app COPY . . COPY --from=deps /app/node_modules ./node_modules + RUN yarn build --filter=user FROM node:20-alpine AS runner WORKDIR /app -COPY --from=builder /app/apps/user/.next ./.next +COPY --from=builder /app/apps/user/.next/standalone ./ +COPY --from=builder /app/apps/user/.next/static ./.next/static COPY --from=builder /app/apps/user/public ./public -COPY --from=builder /app/apps/user/package.json ./package.json -COPY --from=builder /app/packages ./packages -COPY --from=builder /app/node_modules ./node_modules EXPOSE 3000 -CMD ["yarn", "start"] \ No newline at end of file +CMD ["node", "server.js"] diff --git a/apps/user/next.config.js b/apps/user/next.config.js index 5f9b2af1..41605bf6 100644 --- a/apps/user/next.config.js +++ b/apps/user/next.config.js @@ -1,5 +1,6 @@ /** @type {import('next').NextConfig} */ module.exports = { + output: 'standalone', reactStrictMode: true, transpilePackages: ['@jeiltodo/ui'], eslint: {