The video demonstrates how to optimize and refactor Docker files for microservices. The process includes isolating application code, managing service-specific package dependencies, troubleshooting build errors, and tagging Docker images for deployment to Google Cloud.
Length 13:11
Captions English (Generated), Spanish (Auto-translated), French (Auto-translated), Korean (Auto-translated), Portuguese (Auto-translated), Vietnamese (Auto-translated) #docker #microservices #cloud #gcloud #refactoring #deployment #optimization #programming #software engineering #containerization
0:00 Before we go ahead and build and push up our Docker containers to 0:04 Google Cloud, let's go ahead and refactor our Docker files to make them 0:08 a little bit lighter and more productionized. 0:11 Currently right now, if we go into our reservations Docker 0:14 file, you can 0:15 see that we're copying over the entire project in one go, 0:19 which means we're gonna be copying over all of our other microservices into 0:23 the build, when in fact we only need to copy over the 0:26 reservations 0:27 folder for the reservation service and the respective folder for each 0:31 of these services. So let's go ahead and refactor this. 0:34 We're gonna copy the 0:36 apps/reservations folder into 0:39 apps/reservations into the Docker container, 0:42 and then we're gonna go ahead and 0:43 copy the libs folder over to the libs directory, because of course, we're 0:47 gonna need the common directory we have in here with all of our common code. 0:51 We'll also need to make sure that we copy over the 0:54 tsconfig.json into our Docker 0:58 file as well, so when we build it, we know how to apply our 1:02 TypeScript settings. Let's CD into our apps folder 1:05 and then into the 1:06 reservations folder. I'll go ahead and Docker build, give this 1:10 a tag of reservations, specify the file is at the 1:14 current directory, and we want our context of where to 1:17 actually build this 1:17 from to be at the root of the project. 1:20 So let's go ahead and let this finish building. 1:22 Okay, so we can see we have an error being 1:24 thrown here from the 1:25 currentuser.decorator. If we go into the currentuser.decorator, 1:30 you can see we're in our common folder, but we're trying to 1:33 import code that lives in, in a, a different 1:37 microservice, in this case, the auth microservice. 1:40 We definitely don't want to be importing from this microservice
The rest of the transcript is for members.
Sign in