chore: update dependencies and add .dockerignore file

- Updated MUI packages to version 5.x and x-charts/x-date-pickers to 7.x
- Downgraded React and React-DOM to version 18.3.1
- Added .dockerignore to exclude unnecessary files from Docker context
This commit is contained in:
hamed
2025-12-10 14:06:19 +03:30
parent a8d4d5c090
commit 6f0c29d700
11 changed files with 2838 additions and 2066 deletions
+54
View File
@@ -0,0 +1,54 @@
# Dependencies
node_modules
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Build outputs
.next
out
dist
build
# Testing
coverage
.nyc_output
# Environment files
.env*.local
.env.development
.env.test
# IDE
.vscode
.idea
*.swp
*.swo
*~
# OS
.DS_Store
Thumbs.db
# Git
.git
.gitignore
.gitattributes
# Docker
Dockerfile
docker-compose.yml
.dockerignore
# Documentation
README.md
CHANGELOG.md
LICENSE
# CI/CD
.github
.gitlab-ci.yml
# Misc
*.log
.cache
+1
View File
@@ -1 +1,2 @@
legacy-peer-deps=true legacy-peer-deps=true
strict-peer-dependencies=false
+1 -1
View File
@@ -10,7 +10,7 @@ function Call({ matchedCity, isDefault }) {
> >
<h1 className="text-[#FAFAFA] text-[20px] font-bold">تماس با ما</h1> <h1 className="text-[#FAFAFA] text-[20px] font-bold">تماس با ما</h1>
<h2 className="text-[#FAFAFA] leading-[26px] text-[14px] md:text-[16px] font-normal mt-6"> <h2 className="text-[#FAFAFA] leading-[26px] text-[14px] md:text-[16px] font-normal mt-6">
{matchedCity.footerDescription} {matchedCity?.footerDescription || "برای ارتباط با ما از راه های زیر استفاده کنید"}
</h2> </h2>
<Links matchedCity={matchedCity} /> <Links matchedCity={matchedCity} />
</div> </div>
+3 -3
View File
@@ -11,20 +11,20 @@ function Links({ matchedCity }) {
<ContentContact <ContentContact
url="tel:900300400" url="tel:900300400"
label="تلفن تماس: " label="تلفن تماس: "
text={matchedCity.contactPhone} text={matchedCity?.contactPhone || "900300400"}
> >
<CallC /> <CallC />
</ContentContact> </ContentContact>
<ContentContact <ContentContact
url="https://wa.me/09124568794" url="https://wa.me/09124568794"
text={matchedCity.socialMedia.whatsapp} text={matchedCity?.socialMedia?.whatsapp || "09124568794"}
label="واتساپ: " label="واتساپ: "
> >
<WhatsappC /> <WhatsappC />
</ContentContact> </ContentContact>
<ContentContact <ContentContact
url="mailto:batome@gmail.com" url="mailto:batome@gmail.com"
text={matchedCity.email} text={matchedCity?.email || "info@nobat724.com"}
label="ایمیل: " label="ایمیل: "
> >
<EmailC /> <EmailC />
+2 -2
View File
@@ -2,8 +2,8 @@ import { getStateInfo } from "@/lib/getStateInfo";
import Call from "./call/Call"; import Call from "./call/Call";
import Connect from "./Connect"; import Connect from "./Connect";
function ContactUsPage() { async function ContactUsPage() {
const { matchedCity } = getStateInfo(); const { matchedCity } = await getStateInfo();
const isDefault = matchedCity?.id === "63"; const isDefault = matchedCity?.id === "63";
return ( return (
+1 -2
View File
@@ -1,5 +1,4 @@
import Image from "next/image"; import Image from "next/image";
import Logo from "@/public/assets/images/logo.png";
import Services from "./Services"; import Services from "./Services";
import Address from "./Address"; import Address from "./Address";
import Telefon from "./Telefon"; import Telefon from "./Telefon";
@@ -11,7 +10,7 @@ function Poster({ data }) {
<div className="bg-poster overflow-hidden !pt-[32px] p-[24px] relative flex justify-between items-start"> <div className="bg-poster overflow-hidden !pt-[32px] p-[24px] relative flex justify-between items-start">
<div> <div>
<div className="flex items-center justify-start gap-[5px]"> <div className="flex items-center justify-start gap-[5px]">
<Image src={Logo} width={30} height={30} alt="logo" /> <Image src="/assets/images/logo.png" width={30} height={30} alt="logo" />
<p className="text-[#E7EEF6] text-[16px] font-bold !-translate-y-1"> <p className="text-[#E7EEF6] text-[16px] font-bold !-translate-y-1">
nobat724.com nobat724.com
</p> </p>
+59 -29
View File
@@ -1,54 +1,84 @@
# ============================================================================= # =============================================================================
# Docker Compose - Production Configuration for Coolify # Docker Compose - Production Configuration
# ============================================================================= # =============================================================================
# Optimized for: # Optimized for: Coolify deployment with production best practices
# - Fast cold starts
# - Minimal resource usage
# - Zero-downtime deployments
# - Coolify compatibility
# ============================================================================= # =============================================================================
services: services:
app: app:
image: nobat724-front:latest
container_name: nobat724-app
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
# Enable BuildKit for faster builds and layer caching # Enable BuildKit for better caching
args: args:
- BUILDKIT_INLINE_CACHE=1 BUILDKIT_INLINE_CACHE: "1"
- DOCKER_BUILDKIT=1 # Multi-platform support (optional)
# Cache strategy for faster rebuilds # platforms:
cache_from: # - linux/amd64
- node:20-alpine # - linux/arm64
# Container restart policy # Restart policy
restart: unless-stopped restart: unless-stopped
# Dynamic port mapping (Coolify manages external port) # Port mapping (Coolify handles external mapping)
ports: ports:
- "3000" - "3000:3000"
# Environment variables # Environment variables
# Note: Coolify injects these automatically from project settings
environment: environment:
# Node.js # Next.js runtime
- NODE_ENV=${NODE_ENV:-production} PORT: 3000
- PORT=3000 HOSTNAME: "0.0.0.0"
- HOSTNAME=0.0.0.0 NODE_ENV: production
- DEV_MODE=false NEXT_TELEMETRY_DISABLED: 1
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
- NEXT_PUBLIC_CLIENT_ID=${NEXT_PUBLIC_CLIENT_ID}
- NEXT_PUBLIC_CLIENT_SECRET=${NEXT_PUBLIC_CLIENT_SECRET}
# Resource limits (optimized for low traffic sites) # API configuration
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-https://api.nobat724.com}
NEXT_PUBLIC_CLIENT_ID: ${NEXT_PUBLIC_CLIENT_ID}
NEXT_PUBLIC_CLIENT_SECRET: ${NEXT_PUBLIC_CLIENT_SECRET}
DEV_MODE: "false"
# Health check (uses Dockerfile HEALTHCHECK)
healthcheck:
test:
[
"CMD-SHELL",
'node -e "require(''http'').get(''http://localhost:3000/'', (res) => { process.exit(res.statusCode === 200 ? 0 : 1); }).on(''error'', () => { process.exit(1); });"',
]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Resource limits
deploy: deploy:
resources: resources:
limits: limits:
cpus: "0.5" cpus: "1.0"
memory: 512M memory: 1G
reservations: reservations:
cpus: "0.1" cpus: "0.25"
memory: 128M memory: 256M
# Logging configuration
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Security options
security_opt:
- no-new-privileges:true
# Read-only root filesystem (except for .next cache)
# read_only: true
# tmpfs:
# - /tmp
# - /app/.next/cache
# Networks (Coolify uses bridge network) # Networks (Coolify uses bridge network)
networks: networks:
+68 -27
View File
@@ -1,48 +1,89 @@
# Dockerfile for Next.js 14 - Optimized for Production # =============================================================================
# Multi-stage Dockerfile for Next.js 15 - Production Optimized
# =============================================================================
# Stage 1: Dependencies - Install all dependencies
# Stage 2: Builder - Build the application
# Stage 3: Runner - Production runtime
# =============================================================================
# Use the official Node.js image with Alpine Linux for a smaller footprint # -----------------------------------------------------------------------------
FROM node:22-alpine AS base # Stage 1: Dependencies
# -----------------------------------------------------------------------------
FROM node:22-alpine AS deps
# Install system dependencies for node-gyp
RUN apk add --no-cache libc6-compat
# Set the working directory in the container
WORKDIR /app WORKDIR /app
# Copy package.json and package-lock.json (or yarn.lock) # Copy dependency files
COPY package*.json ./ COPY package.json package-lock.json* ./
# Install dependencies - leveraging Docker cache # Install dependencies
RUN npm i --force # Use npm ci for reproducible builds
RUN npm ci --legacy-peer-deps || npm install --legacy-peer-deps
# Copy the rest of the application code # -----------------------------------------------------------------------------
# Stage 2: Builder
# -----------------------------------------------------------------------------
FROM node:22-alpine AS builder
WORKDIR /app
# Copy dependencies from deps stage
COPY --from=deps /app/node_modules ./node_modules
# Copy source code
COPY . . COPY . .
# Build the Next.js application # Set build-time environment variables
ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production
# Build application
RUN npm run build RUN npm run build
# Stage 2: Production image - smaller and leaner # -----------------------------------------------------------------------------
# Stage 3: Runner (Production)
# -----------------------------------------------------------------------------
FROM node:22-alpine AS runner FROM node:22-alpine AS runner
# Set the working directory # Install runtime dependencies
RUN apk add --no-cache \
libc6-compat \
dumb-init
WORKDIR /app WORKDIR /app
# Set environment variables # Set production environment
ENV NODE_ENV $NODE_ENV ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED 1 ENV NEXT_TELEMETRY_DISABLED=1
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
# Add a non-root user for security # Create non-root user for security
RUN addgroup -g 1001 -S nodejs RUN addgroup --system --gid 1001 nodejs && \
RUN adduser -S nextjs -u 1001 adduser --system --uid 1001 nextjs
# Copy only the necessary files from the builder stage # Copy necessary files from builder
COPY --from=base /app/next.config.js ./ COPY --from=builder --chown=nextjs:nodejs /app/next.config.js ./
COPY --from=base /app/public ./public COPY --from=builder --chown=nextjs:nodejs /app/public ./public
COPY --from=base --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
COPY --from=base --chown=nextjs:nodejs /app/.next/static ./.next/static COPY --from=builder --chown=nextjs:nodejs /app/package.json ./
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
# Change ownership of all copied files to the non-root user # Switch to non-root user
USER nextjs USER nextjs
# Expose the port Next.js listens on # Expose port
EXPOSE 3000 EXPOSE 3000
# Command to start the Next.js server in production mode # Health check
CMD ["node", "server.js"] HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD node -e "require('http').get('http://localhost:3000/', (res) => { process.exit(res.statusCode === 200 ? 0 : 1); }).on('error', () => { process.exit(1); });"
# Use dumb-init to handle signals properly
ENTRYPOINT ["dumb-init", "--"]
# Start Next.js in production mode
CMD ["node_modules/.bin/next", "start"]
-1
View File
@@ -1,6 +1,5 @@
// next.config.js // next.config.js
const nextConfig = { const nextConfig = {
output: "standalone",
// Add other configurations below // Add other configurations below
reactStrictMode: true, reactStrictMode: true,
images: { images: {
+2637 -1993
View File
File diff suppressed because it is too large Load Diff
+12 -8
View File
@@ -15,11 +15,11 @@
"@emotion/react": "^11.14.0", "@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1", "@emotion/styled": "^11.14.1",
"@maptiler/sdk": "^3.9.0", "@maptiler/sdk": "^3.9.0",
"@mui/icons-material": "^7.3.6", "@mui/icons-material": "^5.18.0",
"@mui/material": "^7.3.6", "@mui/material": "^5.18.0",
"@mui/styled-engine-sc": "^7.3.6", "@mui/styled-engine": "^5.18.0",
"@mui/x-charts": "^8.21.0", "@mui/x-charts": "^7.29.1",
"@mui/x-date-pickers": "^8.21.0", "@mui/x-date-pickers": "^7.29.4",
"@next/third-parties": "^15.5.7", "@next/third-parties": "^15.5.7",
"aos": "^2.3.4", "aos": "^2.3.4",
"axios": "^1.13.2", "axios": "^1.13.2",
@@ -38,8 +38,8 @@
"npm": "^11.7.0", "npm": "^11.7.0",
"qrcode": "^1.5.4", "qrcode": "^1.5.4",
"qrcode.react": "^4.2.0", "qrcode.react": "^4.2.0",
"react": "^19.2.1", "react": "^18.3.1",
"react-dom": "^19.2.1", "react-dom": "^18.3.1",
"react-easy-crop": "^5.5.6", "react-easy-crop": "^5.5.6",
"react-google-map-picker": "^1.2.3", "react-google-map-picker": "^1.2.3",
"react-images-uploading": "^3.1.7", "react-images-uploading": "^3.1.7",
@@ -56,5 +56,9 @@
"postcss": "^8.5.6", "postcss": "^8.5.6",
"prettier": "^3.7.4", "prettier": "^3.7.4",
"tailwindcss": "^3.4.18" "tailwindcss": "^3.4.18"
},
"overrides": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
} }
} }