-: In last section, we added in a ton of configuration
to our Docker Compose file to get our server up and running.
The server is now aware of a couple
of different environment variables that it's going
to need to successfully connect to both Redis and Postgres.
We're now gonna start to move forward.
The other two sections of configuration
that we need to add into this file are services
for both the worker and the client projects.
So let's add both those in right now.
I'm gonna go down to the bottom of the file
and I'll add in a new service that we'll call "Client".
Now for the client service, we're gonna end up
with a couple of different properties
that are just about identical
to the last Docker Compose file that we put together,
and even identical to the server service
that we just added a moment ago as well.
So for the client, we need to specify a build option
for telling this thing what the context folder is
and where the Docker file is.
We also need to specify the relevant volumes as well,
to make sure that we don't have
to constantly re-build the client image every time
that we change some code inside there.
And then we're gonna do the exact same two steps
for the worker project as well.
So for build on the client,
we're gonna say your Docker file is dockerfile.dev.
And the context is going to be the client directory.
So inside the client directory is all the source code
relevant for the client service.
The context will be ./client like so.
We'll then set up the two volumes for the client.
So I'll say volumes. We're going again going to say
that we want to put that kind of Bookmark halt
on app node_modules. So that's gonna make sure
that the node_modules directory
inside the container does not get overwritten
by any node_modules folder
that we might have inside the client.
And then we'll also set up the relationship
between all of the source code inside the client directory
and the app folder inside of the container.
So I'll say everything
inside the client directory should be shared
with the app folder inside the container.
All right, so now last thing we need to do is set
up the same service for our worker process as well.
So I'll say we're gonna have a worker service.
It will have a Build with a Docker file of Dockerfile.dev.
It will have a context of the worker directory.
And it's gonna have volumes of both app node_modules
and ./worker. And everything inside
that folder is gonna be kind of mapped over virtually
to the app folder inside of the container.
All right, so that looks pretty good.
Now, we're just about done with a Docker Compose file.
But you might notice that there's one very
distinct thing that we're currently missing
inside the entire project.
We have not yet set up any port mapping whatsoever.
So there's no port mapping to expose the server
to the outside world.
And there's no mapping for the React project
as well as we had done on the previous React project
that we just put together. Now I wanna direct you back
to a diagram we were looking at just a moment ago.
This one right here. So we had said that with development,
we were gonna have this NGINX server out here
that was somehow reacting to information
or kind of like proxying or routing it requests
from the browser to the React server or the Express server.
Let's take a quick pause right now.
We'll come back to the next section, and we'll talk
about the purpose of this little NGINX thing right here,
and what it's going to be doing for us.
So I'll see you in just a minute.