1
00:00:00,330 --> 00:00:06,210
So the first part of our set up is the no application, I already created the project and it's hosted

2
00:00:06,210 --> 00:00:09,400
on git repositories so you can download it from there.

3
00:00:09,810 --> 00:00:13,980
So we're going to go and clone this application, first of all.

4
00:00:14,010 --> 00:00:14,400
Right.

5
00:00:14,430 --> 00:00:15,870
So let's get the deed.

6
00:00:15,870 --> 00:00:16,370
Come in.

7
00:00:18,390 --> 00:00:29,340
And here I'm going to create a new directory, let's call it course projects, and I'm going to clone

8
00:00:29,340 --> 00:00:30,590
it right here.

9
00:00:33,840 --> 00:00:38,820
I have intelligence, so I'm going to open the app and Intelligent Ed.

10
00:00:40,950 --> 00:00:46,800
So the structure of the application is super simple, and we're going to go through the couple of files

11
00:00:46,800 --> 00:00:48,190
that the application includes.

12
00:00:48,540 --> 00:00:54,630
So first of all, the main file where the whole thing is happening is Sergius, which is an app folder.

13
00:00:54,930 --> 00:00:55,840
Let's look inside.

14
00:00:56,520 --> 00:01:02,910
So first of all, we have the express module, which we use to start the application at this port.

15
00:01:03,240 --> 00:01:10,470
And the second one we have is Peno, which is a logging library or logging module, which is, again,

16
00:01:10,470 --> 00:01:11,400
super simple.

17
00:01:11,400 --> 00:01:18,690
We just initiated right here with a log level and we just log a bunch of stuff because we need some

18
00:01:18,690 --> 00:01:23,530
information or some log data for our Lustick stack setup.

19
00:01:24,240 --> 00:01:30,390
And here in this constructor of Peno, you can actually configure the logging format, your custom fields

20
00:01:30,390 --> 00:01:30,990
and so on.

21
00:01:31,140 --> 00:01:38,160
So we are going to add configuration for timestamp format because I believe Pinole by default, we log

22
00:01:38,160 --> 00:01:40,000
in EPOP milliseconds.

23
00:01:40,000 --> 00:01:42,420
So we want a proper timestamp.

24
00:01:42,720 --> 00:01:48,620
And this takes actually a function that returns the format of a timestamp.

25
00:01:48,900 --> 00:01:52,500
And I'm actually going to paste in the one that I have.

26
00:01:54,000 --> 00:02:00,390
So this will just format into this ISO string and the name of the field will be time.

27
00:02:00,870 --> 00:02:04,830
And we're doing this to make parsing this log data easier.

28
00:02:05,610 --> 00:02:06,760
And that's it.

29
00:02:06,810 --> 00:02:08,850
This is all the application does.

30
00:02:09,040 --> 00:02:13,280
And these two dependencies right here are defined in package, trace and file.

31
00:02:13,440 --> 00:02:15,780
So we have express and Peno right here.

32
00:02:16,300 --> 00:02:22,710
I'm actually going to fixate this version so that you don't end up with different ones to make sure

33
00:02:22,710 --> 00:02:26,010
there's consistency and also to make sure there is consistency.

34
00:02:26,010 --> 00:02:27,740
Also checked in the node modules.

35
00:02:27,750 --> 00:02:30,880
So you must have it when you clone this repository.

36
00:02:30,990 --> 00:02:36,690
So this way I try to minimize your effort for setting up the applications and also to make sure you

37
00:02:36,690 --> 00:02:39,300
have the same versions of the dependencies.

38
00:02:39,510 --> 00:02:43,300
Otherwise you would have to do NPM install so you don't have to do it.

39
00:02:43,320 --> 00:02:48,830
In this case, it's the node modules or the dependencies are already there.

40
00:02:49,920 --> 00:02:50,870
So we have the scripts.

41
00:02:50,880 --> 00:02:55,920
This doesn't do anything, just EKOS and the START script is the one that starts our application.

42
00:02:55,920 --> 00:02:56,240
Right?

43
00:02:56,460 --> 00:03:02,640
So we have node come in that starts up server JS super, super simple.

44
00:03:02,880 --> 00:03:12,150
We have get ignored, which basically excludes all the non project relevant files and directories and

45
00:03:12,180 --> 00:03:13,230
that's really it.

46
00:03:13,260 --> 00:03:14,640
That's our whole application.

47
00:03:15,020 --> 00:03:21,780
In order to build the image based on this no JS application, we have a Docker file which does a couple

48
00:03:21,780 --> 00:03:22,300
of things.

49
00:03:22,440 --> 00:03:24,180
So let's go through that line by line.

50
00:03:24,480 --> 00:03:27,810
We are basing it on the node image.

51
00:03:29,490 --> 00:03:32,120
This is a tag of the node based image.

52
00:03:32,520 --> 00:03:36,960
Then we take the package, chasten in package log, Jason.

53
00:03:37,410 --> 00:03:45,750
So both of this from right here and we copied into the container filesystem.

54
00:03:45,750 --> 00:03:46,050
Right.

55
00:03:46,410 --> 00:03:53,850
So this is our host file system and we copy that, those two files inside the image under this path

56
00:03:54,300 --> 00:03:55,320
or this directory.

57
00:03:57,300 --> 00:04:01,740
If it's not there, it's going to get created, then we copy.

58
00:04:02,810 --> 00:04:09,080
What's inside the EP, so this is going to be Sergius also inside the directory, so we're going to

59
00:04:09,080 --> 00:04:10,130
end up with.

60
00:04:12,410 --> 00:04:19,820
With EPP Directory, which has Sergius packages and Package Laugesen inside, and that will be our image,

61
00:04:20,990 --> 00:04:28,970
we also said the work dear or work directory, which basically means that you tell Docteur, Hey, this

62
00:04:28,970 --> 00:04:32,000
is going to be my route directory inside the container.

63
00:04:32,480 --> 00:04:33,860
So whenever you.

64
00:04:34,990 --> 00:04:41,780
Referred to files, so, for example, server, James, you don't have to use the whole path like like

65
00:04:42,320 --> 00:04:49,370
a server J.S. you can just say submerges, which we are doing right here.

66
00:04:49,780 --> 00:04:53,050
So this is basically equivalent to this right here.

67
00:04:53,830 --> 00:05:03,700
However, before this COMEN runs, we need to execute NPM install inside the container so that the dependencies

68
00:05:04,150 --> 00:05:11,740
that we define here, Expressen, Peno get installed and the node modules directorate gets created because

69
00:05:11,740 --> 00:05:14,610
we're not copying this one inside the container.

70
00:05:14,620 --> 00:05:14,990
Right.

71
00:05:15,310 --> 00:05:21,160
So first NPM install will get executed and then node server doges.

72
00:05:22,170 --> 00:05:24,780
So we have everything we need to build that image.

73
00:05:25,140 --> 00:05:32,070
I also put the comments in the read me files so you can check that here and let's go and execute those

74
00:05:32,070 --> 00:05:32,550
comments.

75
00:05:32,820 --> 00:05:37,530
So in order to build the Docker image, I'm inside the root folder right here.

76
00:05:37,590 --> 00:05:44,530
Obviously, you can also do it on the command line, but I think it's easier in the terminal of intelligence.

77
00:05:45,240 --> 00:05:46,460
So I'm going to execute it here.

78
00:05:46,710 --> 00:05:48,270
So Docker build.

79
00:05:49,470 --> 00:05:57,810
And if you want to give our image a name instead of some anonymous name, we are going to add minus

80
00:05:57,810 --> 00:06:01,290
T, which is TEG and let's call it node EP.

81
00:06:01,770 --> 00:06:05,760
And the DOT is basically the location of Toker file.

82
00:06:05,760 --> 00:06:06,060
Right.

83
00:06:06,240 --> 00:06:10,560
And I'm executing it from route where the Docker file is.

84
00:06:10,560 --> 00:06:12,450
I can just say current directory.

85
00:06:12,810 --> 00:06:13,890
That's where Dr. Files.

86
00:06:14,190 --> 00:06:18,220
And if I execute this it should create the image.

87
00:06:18,450 --> 00:06:22,260
So here you see all those steps got executed.

88
00:06:24,380 --> 00:06:33,050
So six steps, basically, and I have an image, let's actually go to terminal and check our image there

89
00:06:33,590 --> 00:06:36,710
and I'm going to grab that because I have a lot of images.

90
00:06:37,790 --> 00:06:44,600
And here is our image that we just created, and it's ready to be pushed into a repository.
