diff --git a/Dockerfile b/Dockerfile index e003570..5b94891 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # Dockerfile for Next.js 14 - Optimized for Production # Use the official Node.js image with Alpine Linux for a smaller footprint -FROM node:20-alpine AS base +FROM node:22-alpine AS base # Set the working directory in the container WORKDIR /app @@ -10,23 +10,23 @@ WORKDIR /app COPY package*.json ./ # Install dependencies - leveraging Docker cache -RUN npm install --production --frozen-lockfile || yarn install --production --frozen-lockfile +RUN npm i --force # Copy the rest of the application code COPY . . # Build the Next.js application -RUN npm run build || yarn build +RUN npm run build # Stage 2: Production image - smaller and leaner -FROM node:20-alpine AS runner +FROM node:22-alpine AS runner # Set the working directory WORKDIR /app # Set environment variables ENV NODE_ENV production -ENV NEXT_TELEMETRY_DISABLED 1 # Opt-out of Next.js telemetry +ENV NEXT_TELEMETRY_DISABLED 1 # Add a non-root user for security RUN addgroup -g 1001 -S nodejs diff --git a/components/dashboard/userAccount/detailUser/information/Form.js b/components/dashboard/userAccount/detailUser/information/Form.js index c19db60..5e6f911 100644 --- a/components/dashboard/userAccount/detailUser/information/Form.js +++ b/components/dashboard/userAccount/detailUser/information/Form.js @@ -101,7 +101,6 @@ function Form({ insurance, errors, changeData, information }) { updateData={(name, val) => { changeData([Number(val.id)], name); }} - // value={findVal(insurance, "basic_insurance", true)?.name} value={insurance?.find( (g) => Number(g.id) === @@ -127,8 +126,6 @@ function Form({ insurance, errors, changeData, information }) { changeData={changeData} data={information?.insurance_id} name="insurance_id" - // data={information?.supplementary_insurance} - // name="supplementary_insurance" /> diff --git a/docker-compose.yml b/docker-compose.yml index 2a8e54a..d45d186 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,11 +13,12 @@ services: - NEXT_PUBLIC_CLIENT_ID=${NEXT_PUBLIC_CLIENT_ID} - NEXT_PUBLIC_CLIENT_SECRET=${NEXT_PUBLIC_CLIENT_SECRET} restart: unless-stopped - container_name: nobat724-frontend ports: - - "3001:3000" + - "${APP_PORT}:3000" environment: - NODE_ENV=production - NEXT_TELEMETRY_DISABLED=1 - 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} \ No newline at end of file diff --git a/nixpacks.toml b/nixpacks.toml index dc109f0..e8cddd6 100644 --- a/nixpacks.toml +++ b/nixpacks.toml @@ -1,5 +1,20 @@ [phases.setup] nixPkgs = ["nodejs_22"] +[phases.install] +cmds = ["npm install --production --frozen-lockfile"] + +[phases.build] +cmds = ["npm run build"] + [start] -cmd = "pnpm run start" +cmd = "node server.js" + +[variables] +NODE_ENV = "production" +NEXT_TELEMETRY_DISABLED = "1" + +# These environment variables will need to be set in your deployment platform +# NEXT_PUBLIC_API_URL - Set in deployment platform +# NEXT_PUBLIC_CLIENT_ID - Set in deployment platform +# NEXT_PUBLIC_CLIENT_SECRET - Set in deployment platform \ No newline at end of file