refactor: update NODE_ENV handling in Dockerfile and docker-compose.yml for better environment configuration

This commit is contained in:
2025-09-28 14:30:00 +03:30
parent 6f35ee3c10
commit fe9d9a4500
3 changed files with 12 additions and 5 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ FROM node:22-alpine AS runner
WORKDIR /app
# Set environment variables
ENV NODE_ENV production
ENV NODE_ENV $NODE_ENV
ENV NEXT_TELEMETRY_DISABLED 1
# Add a non-root user for security
+8 -2
View File
@@ -27,6 +27,8 @@ export async function generateMetadata() {
}
export default function RootLayout({ children }) {
return (
<html lang="fa" dir="rtl" suppressHydrationWarning>
<head>
@@ -36,14 +38,18 @@ export default function RootLayout({ children }) {
/>
</head>
<ThemeRegistry>
<GoogleTagManager gtmId="GTM-NXBSV7GS" />
{process.env.NODE_ENV !== 'development' && (
<GoogleTagManager gtmId="GTM-NXBSV7GS" />
)}
<body className="bg-[#FAFAFA]">
<ProvinceProvider>
<Providers>{children}</Providers>
</ProvinceProvider>
<CustomToastify />
</body>
<GoogleAnalytics gaId="G-HG3RZ1PJS5" />
{process.env.NODE_ENV !== 'development' && (
<GoogleAnalytics gaId="G-HG3RZ1PJS5" />
)}
</ThemeRegistry>
</html>
);
+3 -2
View File
@@ -7,7 +7,7 @@ services:
context: .
dockerfile: Dockerfile
args:
- NODE_ENV=production
- NODE_ENV=${NODE_ENV}
- NEXT_TELEMETRY_DISABLED=1
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
- NEXT_PUBLIC_CLIENT_ID=${NEXT_PUBLIC_CLIENT_ID}
@@ -21,4 +21,5 @@ services:
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
- NEXT_PUBLIC_CLIENT_ID=${NEXT_PUBLIC_CLIENT_ID}
- NEXT_PUBLIC_CLIENT_SECRET=${NEXT_PUBLIC_CLIENT_SECRET}
- APP_PORT=${APP_PORT}
- APP_PORT=${APP_PORT}
- NODE_ENV=${NODE_ENV}