Browse Source

production

master
nwhco 3 weeks ago
parent
commit
e1bc26e926
  1. 25
      Dockerfile
  2. 1
      docker-compose.yml
  3. 7
      next.config.js

25
Dockerfile

@ -1,17 +1,14 @@
# Base image # Base image
FROM node:18.20.5
FROM node:18-alpine
# Set working directory # Set working directory
WORKDIR /usr/src/app WORKDIR /usr/src/app
# Copy package.json and package-lock.json (if exists) # Copy package.json and package-lock.json (if exists)
COPY package.json ./ COPY package.json ./
RUN apt-get update && apt-get install -y build-essential
RUN rm -rf .next
# Install dependencies # Install dependencies
RUN npm install --legacy-peer-deps RUN npm install --legacy-peer-deps
# RUN npm ci
# Copy the rest of the application code # Copy the rest of the application code
COPY . . COPY . .
@ -24,25 +21,9 @@ ENV NODE_ENV=production
ENV NEXT_PUBLIC_REST_API_ENDPOINT=https://mesbahi.nwhco.ir/api ENV NEXT_PUBLIC_REST_API_ENDPOINT=https://mesbahi.nwhco.ir/api
ENV NEXT_PUBLIC_SITE_URL=https://mesbahi.nwhco.ir ENV NEXT_PUBLIC_SITE_URL=https://mesbahi.nwhco.ir
ENV USE_MOCK_DATA=false ENV USE_MOCK_DATA=false
ENV USE_MOCK_DATA=true
# Verify environment variables (برای دیباگ)
# RUN echo "NEXT_PUBLIC_DEFAULT_LANGUAGE=${NEXT_PUBLIC_DEFAULT_LANGUAGE}" && \
# echo "NEXT_PUBLIC_AVAILABLE_LANGUAGES=${NEXT_PUBLIC_AVAILABLE_LANGUAGES}" && \
# echo "NEXT_PUBLIC_ENABLE_MULTI_LANG=${NEXT_PUBLIC_ENABLE_MULTI_LANG}"
# Modify tsconfig.json to ignore type errors (optional)
# RUN sed -i 's/"noEmitOnError": true/"noEmitOnError": false/' tsconfig.json && \
# sed -i 's/"strict": true/"strict": false/' tsconfig.json && \
# sed -i 's/"skipLibCheck": false/"skipLibCheck": true/' tsconfig.json
# # Modify next.config.js to ignore linting and type errors
# RUN sed -i '/eslint:/a \ \ ignoreDuringBuilds: true,' next.config.js && \
# sed -i '/typescript:/a \ \ ignoreBuildErrors: true,' next.config.js
# Build the Next.js application with verbose logging
RUN npm run build --verbose
# Build the Next.js application
RUN npm run build
# Expose the port the app runs on # Expose the port the app runs on
EXPOSE 3000 EXPOSE 3000

1
docker-compose.yml

@ -10,6 +10,7 @@ services:
restart: always restart: always
networks: networks:
- mesbahi_backend_mesbahi - mesbahi_backend_mesbahi
networks: networks:
mesbahi_backend_mesbahi: mesbahi_backend_mesbahi:
external: true external: true

7
next.config.js

@ -10,13 +10,19 @@ const { i18n } = require('./next-i18next.config');
// }); // });
const nextConfig = { const nextConfig = {
basePath: '/dashboard',
assetPrefix: '/dashboard/',
reactStrictMode: true, reactStrictMode: true,
i18n, i18n,
typescript: { typescript: {
ignoreBuildErrors: true, ignoreBuildErrors: true,
}, },
env: {
NEXT_PUBLIC_BASE_PATH: '/dashboard',
},
images: { images: {
domains: [ domains: [
"mesbahi.nwhco.ir",
'via.placeholder.com', 'via.placeholder.com',
'res.cloudinary.com', 'res.cloudinary.com',
's3.amazonaws.com', 's3.amazonaws.com',
@ -31,7 +37,6 @@ const nextConfig = {
'chawkbazarlaravel.s3.ap-southeast-1.amazonaws.com', 'chawkbazarlaravel.s3.ap-southeast-1.amazonaws.com',
'127.0.0.1:8000', '127.0.0.1:8000',
"fastly.picsum.photos", "fastly.picsum.photos",
"mesbahi.nwhco.ir"
], ],
}, },
eslint: { eslint: {

Loading…
Cancel
Save