So the first part of our set up is the no application, I already created the project and it's hosted
on git repositories so you can download it from there.
So we're going to go and clone this application, first of all.
Right.
So let's get the deed.
Come in.
And here I'm going to create a new directory, let's call it course projects, and I'm going to clone
it right here.
I have intelligence, so I'm going to open the app and Intelligent Ed.
So the structure of the application is super simple, and we're going to go through the couple of files
that the application includes.
So first of all, the main file where the whole thing is happening is Sergius, which is an app folder.
Let's look inside.
So first of all, we have the express module, which we use to start the application at this port.
And the second one we have is Peno, which is a logging library or logging module, which is, again,
super simple.
We just initiated right here with a log level and we just log a bunch of stuff because we need some
information or some log data for our Lustick stack setup.
And here in this constructor of Peno, you can actually configure the logging format, your custom fields
and so on.
So we are going to add configuration for timestamp format because I believe Pinole by default, we log
in EPOP milliseconds.
So we want a proper timestamp.
And this takes actually a function that returns the format of a timestamp.
And I'm actually going to paste in the one that I have.
So this will just format into this ISO string and the name of the field will be time.
And we're doing this to make parsing this log data easier.
And that's it.
This is all the application does.
And these two dependencies right here are defined in package, trace and file.
So we have express and Peno right here.
I'm actually going to fixate this version so that you don't end up with different ones to make sure
there's consistency and also to make sure there is consistency.
Also checked in the node modules.
So you must have it when you clone this repository.
So this way I try to minimize your effort for setting up the applications and also to make sure you
have the same versions of the dependencies.
Otherwise you would have to do NPM install so you don't have to do it.
In this case, it's the node modules or the dependencies are already there.
So we have the scripts.
This doesn't do anything, just EKOS and the START script is the one that starts our application.
Right?
So we have node come in that starts up server JS super, super simple.
We have get ignored, which basically excludes all the non project relevant files and directories and
that's really it.
That's our whole application.
In order to build the image based on this no JS application, we have a Docker file which does a couple
of things.
So let's go through that line by line.
We are basing it on the node image.
This is a tag of the node based image.
Then we take the package, chasten in package log, Jason.
So both of this from right here and we copied into the container filesystem.
Right.
So this is our host file system and we copy that, those two files inside the image under this path
or this directory.
If it's not there, it's going to get created, then we copy.
What's inside the EP, so this is going to be Sergius also inside the directory, so we're going to
end up with.
With EPP Directory, which has Sergius packages and Package Laugesen inside, and that will be our image,
we also said the work dear or work directory, which basically means that you tell Docteur, Hey, this
is going to be my route directory inside the container.
So whenever you.
Referred to files, so, for example, server, James, you don't have to use the whole path like like
a server J.S. you can just say submerges, which we are doing right here.
So this is basically equivalent to this right here.
However, before this COMEN runs, we need to execute NPM install inside the container so that the dependencies
that we define here, Expressen, Peno get installed and the node modules directorate gets created because
we're not copying this one inside the container.
Right.
So first NPM install will get executed and then node server doges.
So we have everything we need to build that image.
I also put the comments in the read me files so you can check that here and let's go and execute those
comments.
So in order to build the Docker image, I'm inside the root folder right here.
Obviously, you can also do it on the command line, but I think it's easier in the terminal of intelligence.
So I'm going to execute it here.
So Docker build.
And if you want to give our image a name instead of some anonymous name, we are going to add minus
T, which is TEG and let's call it node EP.
And the DOT is basically the location of Toker file.
Right.
And I'm executing it from route where the Docker file is.
I can just say current directory.
That's where Dr. Files.
And if I execute this it should create the image.
So here you see all those steps got executed.
So six steps, basically, and I have an image, let's actually go to terminal and check our image there
and I'm going to grab that because I have a lot of images.
And here is our image that we just created, and it's ready to be pushed into a repository.