Skip to content

Commit

Permalink
Adjust Prisma settings to work with Docker (#43)
Browse files Browse the repository at this point in the history
* Adjust prisma settings to work with docker

* Add previously missing package

* Remove error catching left over from debugging

* Update route.ts
  • Loading branch information
Advayp authored Jan 18, 2025
1 parent 305da31 commit 706b804
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 16 deletions.
10 changes: 5 additions & 5 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20.10-alpine AS base
FROM node:23.4-alpine AS base

# Install dependencies only when needed
FROM base AS deps
Expand All @@ -9,12 +9,12 @@ WORKDIR /app
# Install dependencies
COPY package.json package-lock.json* ./
RUN npm install
COPY ./prisma ./prisma
RUN npx prisma generate

FROM base AS dev

WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

# Generate prisma migrations
RUN npx prisma generate
COPY --from=deps /app/prisma /app/prisma
COPY . .
9 changes: 1 addition & 8 deletions backend/app/api/user/register/route.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
import prisma from '@/lib/prisma';
import { createSession } from '@/lib/session';
import { User } from '@prisma/client';
import { NextRequest, NextResponse } from 'next/server';

type PostRequest = {
username: string;
};

type PostResponse = {
user: User;
};

export const POST = async (
req: NextRequest
): Promise<NextResponse<PostResponse>> => {
export const POST = async (req: NextRequest) => {
const { username }: PostRequest = await req.json();

const user = await prisma.user.create({
Expand Down
2 changes: 0 additions & 2 deletions backend/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,4 @@ services:
depends_on:
- postgres
volumes:
- .:/app
- /app/node_modules
- /app/.next
3 changes: 2 additions & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"jose": "^5.9.6",
"next": "15.1.4",
"react": "^19.0.0",
"react-dom": "^19.0.0"
"react-dom": "^19.0.0",
"prisma": "^6.2.1"
},
"devDependencies": {
"@eslint/eslintrc": "^3",
Expand Down
1 change: 1 addition & 0 deletions backend/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ datasource db {

generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl-arm64-openssl-3.0.x"]
}

model Genre {
Expand Down

0 comments on commit 706b804

Please sign in to comment.