 So when it comes to working with Docker and building images from within the Docker context, you do have a number of different options. One very popular plugin for a long time was the Fabric8 Maven plugin. You can see here that I have that on the screen and it's been deprecated. And that just happened about six months ago. So I'm recording in May of 2021. So this is a fairly recent change at the time of recording that this was deprecated. It was a really cool project, but that project is no more and so that plugin has been deprecated. It's been picked up by Eclipse and it is now called J-Cube. So J-Cube is a very, very robust plugin. It was basically a branch of the Fabric8 Maven plugin. This is where all the active development is happening. J-Cube works with not only Docker, but Kubernetes and OpenShift. It has a lot of very robust features and I'm going to not use this one right now. Everything is very, very similar, but I'm going to be using a different Fabric8 plugin called the Docker Maven plugin. And there's very easy to get confused as to which Fabric8 Maven plugin we're talking about. The Docker Maven plugin, this at the time of recording is still active. It's still in the Fabric8 repository. You can see here Fabric8.io, Docker Maven plugin. We're still getting commits. There was just a release done just a month or so ago. So on April 4th, this is still active. The core difference is this is a lighter, simpler plugin and it only works with Docker. So only utilizes Docker. And you can see here, we do have a number of options here. We can start, stop, build images and you can see a number of things here. We can even watch for changes and automatically rebuild them. So there's a lot that we can do here. If you needed to run integration tests, bring up a container for an integration test, you could utilize this plugin. We are not going to be covering all the features here. We're primarily going to be looking at two pieces of this to build images. We want to be able to automate our build process using Maven and then push those images up to Docker. But I did want to take a moment, talk about this plugin, the capabilities of it. It does give you very nice integration between Maven and Docker. So we are interested in building Docker images. And what I'm going to do now is going to toggle over to IntelliJ and show you how to start configuring this plugin for use in our project. So let me jump over to IntelliJ. And the first thing we want to do is come in and configure the plugin. So I'm going to put it in right here. So we want to do plugin, group ID, this is going to be IO, fagret8. And it brought in the wrong one. So we actually want the Docker Maven plugin. And I'm going to go with 0341, I think that is the current release. I'm going to double check that. I'm going to toggle over to Chrome real quick. It's actually 35, so we'll update this to 35. We'll get the very latest there. You can see that is red because I do not have that locally. So when I do a build action, this will be brought in. So I go ahead and I'm going to click on refresh to tell IntelliJ and you can see that we're downloading that. Now I'm going to add in some configuration for this. The first thing we can do is we can do verbose. This will give us some additional information out to the console. Nice to see what's happening. And we can build one or more images. So there's a lot of things that you can do with this. We are going to use a Docker file build. You can actually use XML in the palm to declare your build. Here we are going to, I think it's simplest to use the Docker file, especially since we have a multi-stage Docker file here. We want that capabilities preserved. So we will go ahead and do that. And I'm going to say images and image. We'll give this a name. You were calling it kbrest if I remember right. Now we need to declare a build element. And this is how we are actually going to be building our image. And what we need to do here is declare assembly. And this works a lot like the Maven assembly plugin, at least according to the documentation. And we're adding in this line because what we want it to do is it's going to be copying files around and we'll take a look at that closer in the build process. So we're saying descriptor rough artifact. And by default remember we set up the source main Docker file. By default it's going to be looking in that. So we are going to say Docker file. And if I wanted to use a different file name I could declare it like this but I don't need to. And then we can also do a tag of our image. So let's do tags. We can do multiple tags. Here we'll just declare one for the time being. Call that latest. Now one very important thing that we do need to change in our Docker file. This is going to be copying files around. And what we want to do is come to our Docker file. And rather than target, we want to tell it Maven. So now fabricate, the fabricate Maven plugin is going to be running the build. It's going to be running in that context. And the plugin is going to copy files and we'll take a quick look at that. So come back over here. All that looks correct. I'm going to do a refresh here. Make sure that we can see that. I'm going to disable our tests right now. And we'll go ahead and do a clean. That deletes the target directory. We'll do a package. Let me resize some of these. You can see that our target directory is back. And typical build, this is the jar that we want to be including. So now I'm going to come over here under plugins. We can see Docker. And if I was running this from the command line, it'd be simply Maven Docker build. So I'm going to do the Docker build. And the way this is working, I'm doing it in sequence. If we were running from a command line and we didn't have the target directory created, we'd have to do Maven package Docker colon build. So but right now we've already done the package stuff. I'm going to go ahead and run the build step. You can see that the build did go and complete successfully. And let's take a closer look here. So now we see under target, we have a Docker KB Russ, the name of our image. And then you can see here under build Maven. And that's why we had to set that there. So here we're running in this context. So now we need to tell it's going to be running in the context of the build folder. That's where the Docker builder is going to be executing from. So that's why we need to change that Maven because now our Docker file is now building from that location, so very important. So just to recap what we covered in this video, this is the specifically the fabricate Docker Maven plugin that we added. And IntelliJ hasn't picked that up yet, but I'll go ahead and correct that between the videos. And here the configuration, I did add in verbose to give us a little more chatter in the log so we can see the build steps happening. Otherwise without the verbose, we wouldn't see the image being built like that. We are giving the image a name of KB Russ. Basically this assembly structure here, it tells the plugin to copy this Maven artifact over. So this is a copy that into the build directory for us. We are specifying the Docker file to use. And by default, the plugin is going to be looking at source main Docker. And we're just saying the Docker file there. And we are applying one tag to the image that we're building of latest. And that will get tagged, you can see right here in the log output tag with latest. And if we wanted to specify multiple tags, we could also do so here.