|
@ -1,40 +1,48 @@ |
|
|
# Base image |
|
|
# Base image |
|
|
FROM node:18-alpine |
|
|
|
|
|
|
|
|
FROM node:18.20.5 |
|
|
|
|
|
|
|
|
# Set working directory |
|
|
# Set working directory |
|
|
WORKDIR /usr/src/app |
|
|
WORKDIR /usr/src/app |
|
|
|
|
|
|
|
|
# Copy package.json |
|
|
|
|
|
COPY package.json ./ |
|
|
|
|
|
|
|
|
# Copy package.json and package-lock.json (if exists) |
|
|
|
|
|
COPY package.json ./ |
|
|
|
|
|
RUN apt-get update && apt-get install -y build-essential |
|
|
|
|
|
RUN rm -rf .next |
|
|
|
|
|
|
|
|
# Install dependencies (using npm) |
|
|
|
|
|
|
|
|
# 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 . . |
|
|
COPY .env ./ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Set environment variables |
|
|
ENV NEXT_PUBLIC_DEFAULT_LANGUAGE=en |
|
|
ENV NEXT_PUBLIC_DEFAULT_LANGUAGE=en |
|
|
ENV NEXT_PUBLIC_AVAILABLE_LANGUAGES=en,fr,de |
|
|
|
|
|
|
|
|
ENV NEXT_PUBLIC_AVAILABLE_LANGUAGES=en |
|
|
ENV NEXT_PUBLIC_ENABLE_MULTI_LANG=true |
|
|
ENV NEXT_PUBLIC_ENABLE_MULTI_LANG=true |
|
|
|
|
|
ENV NODE_ENV=production |
|
|
|
|
|
ENV NEXT_PUBLIC_REST_API_ENDPOINT=https://mesbahi.nwhco.ir/api |
|
|
|
|
|
ENV NEXT_PUBLIC_SITE_URL=https://mesbahi.nwhco.ir |
|
|
|
|
|
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) |
|
|
# 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 |
|
|
|
|
|
|
|
|
|
|
|
RUN sed -i '/eslint:/a \ \ ignoreDuringBuilds: true,' next.config.js && \ |
|
|
|
|
|
sed -i '/typescript:/a \ \ ignoreBuildErrors: true,' next.config.js |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Build the Next.js application |
|
|
|
|
|
# RUN npm run build |
|
|
|
|
|
|
|
|
# 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 |
|
|
|
|
|
|
|
|
RUN mkdir -p .next && echo "dummy-build-id" > .next/BUILD_ID |
|
|
|
|
|
|
|
|
# # 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 |
|
|
|
|
|
|
|
|
# Expose the port the app runs on |
|
|
# Expose the port the app runs on |
|
|
EXPOSE 3000 |
|
|
EXPOSE 3000 |
|
|