nextui icon indicating copy to clipboard operation
nextui copied to clipboard

[BUG] - NextUI + Docker

Open krychaxp opened this issue 3 years ago β€’ 7 comments

NextUI Version

2.1.13

Describe the bug

when i build app normalny - it works, but when I build app with docker, nextui styles doesn't add to tailwind CSS output file

FROM node:20-alpine AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable

FROM base AS builder
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
COPY . .
RUN pnpm run build

# Production image, copy all the files and run next
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/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 3000

ENV PORT 3000

CMD ["node", "server.js"]
import { nextui } from '@nextui-org/react';

/** @type {import('tailwindcss').Config} */
const config = {
  content: [
    './src/app/**/*.{js,ts,jsx,tsx}',
    './src/components/**/*.{js,ts,jsx,tsx}',
    './node_modules/@nextui-org/**/*.{js,ts,jsx,tsx}',
  ],
  theme: {
    extend: {},
  },
  darkMode: 'class',
  plugins: [nextui({ defaultTheme: 'dark' })],
};

export default config;

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

run some tailwind+nextjs+nextui app with docker

Expected behavior

nextui styles should be add in tailwind CSS output file

Screenshots or Videos

No response

Operating System Version

Windows 11

Browser

Chrome

krychaxp avatar Oct 05 '23 09:10 krychaxp

after some hours, i found the problem, i should use COPY package.json pnpm-lock.yaml .npmrc ./ instead of COPY package.json pnpm-lock.yaml ./ πŸ€¦β€β™‚οΈ

krychaxp avatar Oct 05 '23 16:10 krychaxp

after some hours, i found the problem, i should use COPY package.json pnpm-lock.yaml .npmrc ./ instead of COPY package.json pnpm-lock.yaml ./ πŸ€¦β€β™‚οΈ

saved my day, I have spent on this for 1 day

BarrySong97 avatar Mar 25 '24 06:03 BarrySong97

after some hours, i found the problem, i should use COPY package.json pnpm-lock.yaml .npmrc ./ instead of COPY package.json pnpm-lock.yaml ./ πŸ€¦β€β™‚οΈ

Thanks, it is working 🫢🏻

abujafari avatar Apr 07 '24 12:04 abujafari

FROM oven/bun:1 AS base
WORKDIR /usr/src/app

# install dependencies into temp directory
# this will cache them and speed up future builds
FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile

# install with --production (exclude devDependencies)
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production

# copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
FROM base AS prerelease
COPY --from=install /temp/dev/node_modules node_modules
COPY . .

# [optional] tests & build
ENV NODE_ENV=production
ARG BACKEND_URL
ENV BACKEND_URL=$BACKEND_URL
RUN bun --bun next build --no-lint
#RUN ls -la;sleep 10s;

# copy production dependencies and source code into final image
FROM base AS release

COPY --from=prerelease /usr/src/app/public ./public
COPY --from=prerelease /usr/src/app/.next/standalone ./
COPY --from=prerelease /usr/src/app/.next/static ./.next/static

#RUN ls -la;
# Allow all users to read the app
RUN chmod -R 777 /usr/src/app/.next /usr/src/app/public

# env
ARG BACKEND_URL
ENV BACKEND_URL=$BACKEND_URL

USER nextjs

# run the app
USER bun
EXPOSE 3000/tcp
CMD ["bun", "--bun", "server.js"]

Hi guys, I have a solution with bun image (NextJS + NextUI). Hope it will help you.

TongDucThanhNam avatar Oct 07 '24 05:10 TongDucThanhNam

COPY package.json pnpm-lock.yaml .npmrc ./

I spent 2 days trying to solve this error, I tried using AI but the correct answer was here in Github Issues. Thanks a lot!

LukasdeSouza avatar May 28 '25 16:05 LukasdeSouza

thanks bro a lot broh

qsaifudin avatar Sep 23 '25 11:09 qsaifudin

+1. Legend, thanks @krychaxp

thatkev avatar Nov 17 '25 08:11 thatkev