So let's start off in the Docker file where, just like we've done in the reservation's Docker file,
which we can reference here, we're going to go ahead and copy our Prisma schema into the auth container.
So swap this app's reservations out for app slash auth.
So now we have the Prisma schema.
We'll go ahead and run npm prisma generate to generate our client types.
And now if we scroll down in our command here, we can now use the same command that we're using in
reservations.
So I'll copy it because we're going to be using the same shared package.json.
At our root, we know we're going to have the same start prod command that we refactored.
We can run start prod to execute any migrations that are going to be in our current working folder,
which we know is going to be the Prisma folder we copied in the auth service here.
So we're going to execute these migrations in auth when we start up here.
And then finally supply the correct path to the auth service.
Main.js.
So now our Docker file is refactored.
Make sure you go ahead and rebuild it.
So we use the latest code by running build tag auth.
Specify the Dockerfile and go to the root of the project.
Now, just the same as we've done before in reservations, head back to the root docker compose so we
can update our start command to work, just like we did for reservations.
We want to execute any migrations in the Docker container as well as update our client types.
So I'll go ahead and swap out the command here for the reservations one.
And let's simply refactor the path to the schema now.
So we'll go to app slash auth Prisma schema to migrate deploy to execute any migrations we need to.
And now for the Prisma generate command to generate the client types I'll point to app slash auth as
well.
And finally to start up we start up the auth service like so.
Now, just the same as we did, I'll copy the depends on block for reservations and also add this for
auth.
Since we know we're executing migrations against the Postgres database, we want this to be running
before we start up auth.
So now we fully refactored our docker setup to work with Prisma.
We are now ready to start up the auth container.
So let's go ahead and run docker compose up auth.
So just the same as we saw for reservations we have this three stage process.
To start the container up.
We are applying our migration against the database.
So this one it found to create the user table.
We are then generating the latest types and starting up our container.
So this is all working as expected which is excellent.