Let's comment in the composer service.
And let's now ensure that we also set up
this container which will now be a utility container,
which will then not only be used internally by Laravel,
but which most importantly can be used by us,
to also set up a Laravel application in the first place.
For this, I'll add another Dockerfile, a custom Dockerfile,
because I will need a base image with some fine tuning.
So here I'll add the composer.dockerfile.
And I'll start with a base image,
which is the composer image.
And that's really great.
If you search Docker Hub, there is a composer base image,
which basically is an image
that has this composer tool already installed,
which of course is awesome.
So we can start on this composer image
and use the latest tag, for example,
to use the very latest image version.
And now here's the reason why I need my custom Dockerfile,
because I want to specify an entry point.
Now as a side note, there would be a way of doing this
in the docker-compose file as well.
But I'll come back to that later.
This is the approach I like
because we have it is very clear,
easy to understand Dockerfile.
In my entry point now is the composer executable
which exists inside of this composer image and container,
unlike on my local host machine as I showed you before,
and I'll add a flag which should be added
to every command which is executed by it.
And that's the --ignore-platform-reqs command.
This ensures that we can run this without any warnings
or errors even if some dependencies would be missing.
Now very important,
we need to set the right working directory
and set this to /var/www/html.
Because that is where our code will later be.
Save this and go back to docker-compose.
Now that we got the Dockerfile,
we can add the build, configuration here
to the composer service and set the context
to ./dockerfiles.
And set the Dockerfile option to compose.dockerfile
because that is the Dockerfile we wanna use here
to build this image.
Now we need to ensure that we expose our
source code directory to that image,
so that this image works on our source code directory,
and when we use it to install Laravel
and set up a Laravel project,
it does so in our source folder.
And it should of course do this
in this /var/www/html folder internally.
So therefore, here we can add a volume
and bind our source folder to this /var/www/html folder
inside of the container.
So now if we use composer to, for example,
create a Laravel application in this folder
inside of the container.
This will then be mirrored back into our source folder
on the local host machine.
That's essentially what I also already showed you
in the last course section with NPM and Node.
And with this done, we can pause for a second,
we now have our free application containers which will need
to run the Laravel application.
And we got this utility container which we need
to create it, we'll need the other two utility containers
for a certain features inside of Laravel.
But for the moment, we can ignore them.
And instead we can start using
the composer utility container
to create a Laravel application.
And then we can see if we can launch
this application with help
of our free containers.
So how do we do that?