Skip to content
Merged

Dev #134

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 53 additions & 5 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,55 @@
Dockerfile
.dockerignore
# dependencies
node_modules
npm-debug.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# testing
coverage

# next.js
.next/
out/
build
dist

# misc
.DS_Store
*.pem

# debug
*.log

# local env files - DO NOT copy to container
.env
.env.local
.env.development
.env*.local

# Only .env.production will be used in Docker
# vercel
.vercel

# typescript
*.tsbuildinfo

# git
.git
.gitignore
README.md
.next
.git
CONTRIBUTING.md
SECURITY.md
LICENSE

# docker
Dockerfile
.dockerignore
docker-compose.yml

# IDE
.vscode
.idea

# GitHub
.github
14 changes: 12 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
NODE_ENV=developmnet
ANALYZE=false
# Environment
NODE_ENV=development

# Build Analysis
ANALYZE=false

# Telemetry (set to 1 to disable)
NEXT_TELEMETRY_DISABLED=1

# Add any other environment variables your app needs below
# NEXT_PUBLIC_API_URL=
# NEXT_PUBLIC_ANALYTICS_ID=
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ yarn-error.log*

# env files (can opt-in for committing if needed)
.env
.env.local
.env*.local
.env.development
.env.production

# vercel
.vercel
Expand Down
69 changes: 0 additions & 69 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,75 +70,6 @@ Please ensure that:

This helps us keep the `main` branch stable and production-ready.

## Folder Structure

```bash
NURUI/
├── .github/
├── .next/
├── .vercel/
├── .vscode/
├── node_modules/
├── public/
├── src/
│ ├── app/
│ │ ├── (docs)/
│ │ ├── about-us/
│ │ ├── playground/
│ │ ├── favicon.ico
│ │ ├── globals.css
│ │ ├── layout.tsx
│ │ ├── MainContent.tsx
│ │ ├── page.tsx
│ │ └── ThemeProvider.tsx
│ ├── cli/
│ │ ├── bin/
│ │ └── node_modules/
│ │ ├── README.md
│ │ ├── .npmignore
│ │ ├── package-lock.json
│ │ └── package.json
│ └── components/
│ ├── common/
│ ├── icons/
│ ├── nurui/
│ ├── pages/
│ └── ui/
├── content/
├── docs/
├── context/
├── hooks/
├── layout/
├── lib/
├── registry/
│ ├── ComponentNavigation.tsx
│ └── componentsRegistry.tsx
├── styles/
├── types/
├── utils/
├── .gitignore
├── .prettierrc.json
├── CONTRIBUTING.md
├── custom.d.ts
├── eslint.config.mjs
├── LICENSE
├── mdx-components.tsx
├── next-env.d.ts
├── next.config.ts
├── nurui-logo.png
├── og-image.png
├── package.json
├── postcss.config.mjs
├── README.md
├── registry-cli.json
├── registry.json
├── SECURITY.md
├── tailwind.config.ts
├── tailwindcss.d.ts
├── tsconfig.json
└── yarn.lock
```

## How to Add a New Component to Nurui

Follow these 7 simple steps to add a new UI component to the library.
Expand Down
54 changes: 27 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,56 +1,58 @@
FROM ubuntu

# Use Node.js 20 Alpine as base image
FROM node:20-alpine AS base

# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
else echo "Lockfile not found." && exit 1; \
fi
# Copy package files
COPY package.json yarn.lock* ./

# Install dependencies with yarn
RUN yarn install --frozen-lockfile

# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app

# Copy node_modules from deps stage
COPY --from=deps /app/node_modules ./node_modules

# Copy all source files
COPY . .

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
# ENV NEXT_TELEMETRY_DISABLED=1
# Set build-time environment variables
ARG NODE_ENV=production
ARG ANALYZE=false
ENV NODE_ENV=${NODE_ENV}
ENV ANALYZE=${ANALYZE}
ENV NEXT_TELEMETRY_DISABLED=1

RUN \
if [ -f yarn.lock ]; then yarn run build; \
elif [ -f package-lock.json ]; then npm run build; \
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
else echo "Lockfile not found." && exit 1; \
fi
# Build the application
RUN yarn build

# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app

# Set runtime environment variables
ENV NODE_ENV=production
# Uncomment the following line in case you want to disable telemetry during runtime.
# ENV NEXT_TELEMETRY_DISABLED=1
ENV NEXT_TELEMETRY_DISABLED=1
ENV ANALYZE=false

# Create a non-root user
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

# Copy necessary files
COPY --from=builder /app/public ./public

# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

Expand All @@ -59,8 +61,6 @@ USER nextjs
EXPOSE 3000

ENV PORT=3000

# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/config/next-config-js/output
ENV HOSTNAME="0.0.0.0"

CMD ["node", "server.js"]
66 changes: 61 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,58 @@

Visit https://nurui.vercel.app/docs/installation to view the documentation.

## 🛠️ Project Setup
## 🚀 Quick Start

### Option 1: Using Docker (Recommended for Production)

Prerequisite: Docker & Docker Compose installed.

```bash
# 1. Clone the repository
git clone https://github.com/afsar-dev/Nurui.git
cd Nurui

# 2. Create a .env file in the root directory and add:
NODE_ENV=development
# 2. Create production environment file
cat .env.production
# The project uses the existing .env.production file.
# You can modify it if needed.

# 3. Build and start with Docker Compose
yarn docker:compose:up
# Or manually:
docker compose up -d

# The production application will be available at http://localhost:3000
```

### Option 1.1 — Run With Docker (Without Compose)

If you prefer to run Nurui using standard Docker commands:

```bash
# 1. Build Docker Image
yarn docker:build
# Or manually:
docker build -t nurui:latest .

# 2. Run Container
yarn docker:run
# Or manually:
docker run -d \ --name nurui \ -p 3000:3000 \ --env-file .env.production \ nurui:latest
```

### Option 2: Local Development Setup

```bash
# 1. Clone the repository
git clone https://github.com/afsar-dev/Nurui.git
cd Nurui

# 2. Create a .env.development file (or .env) file in the root directory
cat .env

# Add to .env file:
# NODE_ENV=development

# 3. Install dependencies
yarn install
Expand All @@ -33,9 +76,22 @@ yarn dev
# The application will be available at http://localhost:3000
```

<!-- ## Activity
## 🔧 Environment Variables

Create a `.env.production` file for Docker deployment:

![Alt](https://repobeats.axiom.co/api/embed/35271c3244e24efbae34731d1ee21d0988f8fc0e.svg "Repobeats analytics image") -->
```bash
NODE_ENV=production
ANALYZE=false
NEXT_TELEMETRY_DISABLED=1
```

For local Development (.env or .env.development):

```
NODE_ENV=development
ANALYZE=false
```

## License

Expand Down
24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
services:
nurui:
image: nurui:latest
build:
context: .
dockerfile: Dockerfile
args:
- NODE_ENV=production
container_name: nurui-app
ports:
- "3000:3000"
env_file:
- .env.production
environment:
- NODE_ENV=production
- NEXT_TELEMETRY_DISABLED=1
- ANALYZE=false
restart: unless-stopped
networks:
- nurui-network

networks:
nurui-network:
driver: bridge
5 changes: 3 additions & 2 deletions next.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { NextConfig } from "next";
import createMDX from "@next/mdx";
import withBundleAnalyzer from "@next/bundle-analyzer";
import createMDX from "@next/mdx";
import type { NextConfig } from "next";

const isAnalyzerEnabled = process.env.ANALYZE === "true";

Expand All @@ -9,6 +9,7 @@ const analyzer = withBundleAnalyzer({
});

const nextConfig: NextConfig = {
output: "standalone",
images: {
remotePatterns: [
{
Expand Down
Loading