Enhance project configuration by setting output to "standalone" in Next.js config files and updating .gitignore to include example environment files for better clarity and management.
This commit is contained in:
11
dashboard/.dockerignore
Normal file
11
dashboard/.dockerignore
Normal file
@@ -0,0 +1,11 @@
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
node_modules
|
||||
.next
|
||||
.git
|
||||
.gitignore
|
||||
*.md
|
||||
LICENSE
|
||||
npm-debug.log*
|
||||
.eslintrc.json
|
||||
44
dashboard/Dockerfile
Normal file
44
dashboard/Dockerfile
Normal file
@@ -0,0 +1,44 @@
|
||||
# HexaHost Dashboard (Next.js)
|
||||
FROM node:20-alpine AS deps
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm install
|
||||
|
||||
FROM node:20-alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
# Build-time public env (overridden at runtime where possible)
|
||||
ARG NEXT_PUBLIC_BRAND_NAME=HexaHost
|
||||
ARG NEXT_PUBLIC_BRAND_NAME_WORD=HH
|
||||
ARG NEXT_PUBLIC_ADMIN_IDS=
|
||||
ARG NEXT_PUBLIC_API_URL=
|
||||
|
||||
ENV NEXT_TELEMETRY_DISABLED=1 \
|
||||
NEXT_PUBLIC_BRAND_NAME=$NEXT_PUBLIC_BRAND_NAME \
|
||||
NEXT_PUBLIC_BRAND_NAME_WORD=$NEXT_PUBLIC_BRAND_NAME_WORD \
|
||||
NEXT_PUBLIC_ADMIN_IDS=$NEXT_PUBLIC_ADMIN_IDS \
|
||||
NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
|
||||
|
||||
RUN mkdir -p public && npm run build
|
||||
|
||||
FROM node:20-alpine AS runner
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production \
|
||||
NEXT_TELEMETRY_DISABLED=1 \
|
||||
PORT=3000 \
|
||||
HOSTNAME=0.0.0.0
|
||||
|
||||
RUN addgroup --system --gid 1001 nodejs \
|
||||
&& adduser --system --uid 1001 nextjs
|
||||
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
|
||||
USER nextjs
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
@@ -1,5 +1,6 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
output: "standalone",
|
||||
images: {
|
||||
remotePatterns: [
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
reactStrictMode: true,
|
||||
output: "standalone",
|
||||
images: {
|
||||
remotePatterns: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user