Change docker file
This commit is contained in:
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@@ -0,0 +1,3 @@
|
||||
.git
|
||||
.next
|
||||
node_modules
|
||||
@@ -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 . .
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user