diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..eac004e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git +.next +node_modules \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 766f441..0fe93f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,10 @@ ARG MONGODB_DB WORKDIR /app # Install dependencies -COPY package.json package-lock.json* ./ -RUN npm ci +COPY package.json ./ +RUN apk add --no-cache libc6-compat +RUN rm -rf node_modules package-lock.json yarn.lock pnpm-lock.yaml +RUN npm install --omit=dev # Copy the rest of the application COPY . . diff --git a/docker-compose.yaml b/docker-compose.yaml index 6a9572d..dd9848f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,4 @@ -version: '3.9' +version: "3.9" services: app: @@ -7,7 +7,7 @@ services: dockerfile: Dockerfile container_name: cosmos-crm ports: - - '3000:3000' + - "3000:3000" environment: - NODE_ENV=development - MONGODB_URI=mongodb://mongo:27017 @@ -19,7 +19,7 @@ services: image: mongo:7 container_name: mongo ports: - - '27017:27017' + - "27017:27017" volumes: - mongo-data:/data/db diff --git a/src/app/api/customer-dependant/[id]/route.ts b/src/app/api/customer-dependant/[id]/route.ts index 4028154..6755ac6 100644 --- a/src/app/api/customer-dependant/[id]/route.ts +++ b/src/app/api/customer-dependant/[id]/route.ts @@ -3,14 +3,14 @@ import { db } from "@/database/database"; export async function GET( request: NextRequest, - { params }: { params: { id: string } } + { params }: { params: Promise<{ id: string }> } ) { try { // Initialize database await db.read(); // Parse dependant ID from params - const dependantId = parseInt(params.id); + const dependantId = parseInt((await params).id); if (isNaN(dependantId)) { return NextResponse.json( @@ -61,14 +61,14 @@ export async function GET( export async function PUT( request: NextRequest, - { params }: { params: { id: string } } + { params }: { params: Promise<{ id: string }> } ) { try { // Initialize database await db.read(); // Parse dependant ID from params - const dependantId = parseInt(params.id); + const dependantId = parseInt((await params).id); if (isNaN(dependantId)) { return NextResponse.json( @@ -141,14 +141,14 @@ export async function PUT( export async function DELETE( request: NextRequest, - { params }: { params: { id: string } } + { params }: { params: Promise<{ id: string }> } ) { try { // Initialize database await db.read(); // Parse dependant ID from params - const dependantId = parseInt(params.id); + const dependantId = parseInt((await params).id); if (isNaN(dependantId)) { return NextResponse.json(