Skip to content

Commit f92b9af

Browse files
committed
Kubernetes-dashboard: enhance Docker configuration and Next.js settings
- Updated `.dockerignore` to streamline build context by refining ignored files. - Modified `Dockerfile` to set production environment variables and optimize the build process. - Adjusted `next.config.js` to improve output tracing and enable SWC minification, along with experimental package import optimizations. Signed-off-by: NotHarshhaa <reddyharshhaa12@gmail.com>
1 parent bee5fe5 commit f92b9af

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

.dockerignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@ yarn-error.log*
77
# Next.js
88
.next/
99
out/
10-
11-
# Production
12-
build
13-
dist
10+
build/
1411

1512
# Misc
1613
.DS_Store
1714
*.pem
1815

1916
# Debug
2017
npm debug.log*
18+
.env*
2119

2220
# Local env files
2321
.env*.local

.github/workflows/docker-build-push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
env:
1010
REGISTRY: docker.io
11-
IMAGE_NAME: kubernetes-dashboard
11+
IMAGE_NAME: harshhaareddy/kubernetes-dashboard
1212

1313
jobs:
1414
build-and-push:

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ WORKDIR /app
1717
COPY --from=deps /app/node_modules ./node_modules
1818
COPY . .
1919

20-
# Build the application with standalone output
20+
# Build the application with optimizations
21+
ENV NODE_ENV=production
22+
ENV NEXT_TELEMETRY_DISABLED=1
2123
RUN npm run build
2224

2325
# Production image, copy all the files and run next
@@ -27,6 +29,7 @@ WORKDIR /app
2729
ENV NODE_ENV=production
2830
ENV PORT=3000
2931
ENV HOSTNAME=0.0.0.0
32+
ENV NEXT_TELEMETRY_DISABLED=1
3033

3134
# Create a non-root user
3235
RUN addgroup --system --gid 1001 nodejs

next.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
33
output: 'standalone',
4-
outputFileTracingRoot: './',
4+
outputFileTracingRoot: '/app',
5+
swcMinify: true,
6+
compiler: {
7+
removeConsole: process.env.NODE_ENV === 'production',
8+
},
9+
experimental: {
10+
optimizePackageImports: ['lucide-react', 'recharts'],
11+
},
512
}
613

714
module.exports = nextConfig

0 commit comments

Comments
 (0)