A software developer refactors a Dockerfile and Docker Compose configuration to integrate Prisma into an authentication service. The process includes updating schema paths, executing database migrations, generating client types, and rebuilding the container, concluding with a successful deployment of the auth service.
Length 3:00
Captions English (Generated), Spanish (Auto-translated), French (Auto-translated), Korean (Auto-translated), Portuguese (Auto-translated), Vietnamese (Auto-translated) #docker #prisma #auth #database #migration #programming #software #engineering #containerization
0:00 So let's start off in the Docker file where just like we've done 0:04 in the reservations Docker file, which we can reference here, 0:09 we're gonna go ahead and copy our 0:12 Prisma schema into the auth 0:16 container. So swap this apps reservations out for 0:19 app/auth. So now we have the Prisma schema. 0:25 We'll go ahead and run pnpm prisma 0:29 generate 0:30 to generate our client types. And now if we scroll down 0:34 in our command here, we can now use the same command that 0:38 we're using in reservations. So I'll copy it 0:42 because we're gonna be using the same shared package.json at our root. 0:46 We know we're gonna have the same start prod command that we refactored. 0:50 We can run start prod to execute any migrations that are gonna 0:54 be in our current working folder, which we know is going to 0:58 be the Prisma folder we copied in the auth service here. 1:03 So we're gonna execute these migrations in auth when we start up here, 1:07 and then finally supply the correct path to the auth 1:11 service main.js. So now our Docker file is 1:14 refactored. Make sure you go ahead and rebuild it. 1:17 So we use the latest code by running build tag 1:21 auth, 1:22 specify the Docker file and go to the root of the 1:26 project. Now, just the same as we've done before in 1:29 reservations, head back to the root Docker compose so we 1:33 can update our start command to work just like we did for 1:37 reservations. We want to execute any migrations in the 1:40 Docker 1:41 container as well as update our client types. 1:45 So I'll go ahead and swap out the command here for the reservations one, 1:49 and let's simply refactor the path to the schema now. 1:52 So we'll go to app/auth prisma schema 1:56 to migrate deploy to execute any migrations we need to.
The rest of the transcript is for members.
Sign in