1
00:00:02,570 --> 00:00:05,560
[Instructor]Now, with all of that, we've got a working setup

2
00:00:05,560 --> 00:00:07,413
and we're using the tools you learned about

3
00:00:07,413 --> 00:00:09,090
thought this course.

4
00:00:09,090 --> 00:00:13,280
Still, there are a couple of things, a couple of concepts

5
00:00:13,280 --> 00:00:16,750
also introduced in this module I wanna talk about.

6
00:00:16,750 --> 00:00:21,210
For example, adding docker file instructions

7
00:00:21,210 --> 00:00:22,890
in the docker compose file,

8
00:00:22,890 --> 00:00:25,780
like entry point or working dir.

9
00:00:25,780 --> 00:00:29,010
I already mentioned it and I just wanna highlight it again.

10
00:00:29,010 --> 00:00:32,090
This is something you can do,

11
00:00:32,090 --> 00:00:34,350
but not something you have to do.

12
00:00:34,350 --> 00:00:36,700
Creating a docker file instead,

13
00:00:36,700 --> 00:00:40,860
and pointing at that file here, would be an alternative.

14
00:00:40,860 --> 00:00:44,970
You just can add working dir and entry point here

15
00:00:44,970 --> 00:00:46,760
to build up on some base image,

16
00:00:46,760 --> 00:00:48,650
all in the docker compose file

17
00:00:48,650 --> 00:00:51,130
to save that extra docker file

18
00:00:51,130 --> 00:00:54,040
but it is up to you which approach you prefer.

19
00:00:54,040 --> 00:00:58,330
I personally actually like having extra docker files

20
00:00:58,330 --> 00:01:01,960
since I think it makes it very clear of what my intention is

21
00:01:01,960 --> 00:01:05,010
and it keeps the docker compose file lin.

22
00:01:05,010 --> 00:01:06,900
But on the other hand, you always have to look

23
00:01:06,900 --> 00:01:10,300
into those docker files then to see what's going in there.

24
00:01:10,300 --> 00:01:15,040
So you can go either way, and for more complex instructions,

25
00:01:15,040 --> 00:01:16,950
for example, if you need to run

26
00:01:16,950 --> 00:01:18,920
a certain command in an image,

27
00:01:18,920 --> 00:01:20,940
or if you need to copy something

28
00:01:20,940 --> 00:01:22,900
you'll need a docker file anyways

29
00:01:22,900 --> 00:01:25,720
because you don't have copy or run

30
00:01:25,720 --> 00:01:28,850
available here in a docker compose file.

31
00:01:28,850 --> 00:01:31,080
So it's really only for basic images

32
00:01:31,080 --> 00:01:33,440
where you then maybe want to set an entry point

33
00:01:33,440 --> 00:01:36,320
and a working directory you can do that here

34
00:01:36,320 --> 00:01:38,173
in Docker compose if you want to.

35
00:01:39,320 --> 00:01:41,420
Now kind of related to that,

36
00:01:41,420 --> 00:01:45,030
I also want to talk about bind mounts again

37
00:01:45,030 --> 00:01:50,030
at the example of our server service so it is nginx service.

38
00:01:50,720 --> 00:01:54,670
Here I'm binding two volumes or two folders

39
00:01:54,670 --> 00:01:58,290
from my host machine, to folders in the container.

40
00:01:58,290 --> 00:02:01,580
The source folder, so that this code is exposed

41
00:02:01,580 --> 00:02:05,470
to the server and the nginx configuration.

42
00:02:05,470 --> 00:02:08,930
And in general, I'm working with a lot of bind mounts here

43
00:02:08,930 --> 00:02:11,080
all is afforded php container

44
00:02:11,080 --> 00:02:16,080
and also then for composer, artisan and npm.

45
00:02:16,400 --> 00:02:17,830
Now the important thing,

46
00:02:17,830 --> 00:02:21,070
which you always have to keep in mind about bind mounts

47
00:02:21,070 --> 00:02:24,630
which I also already discussed way earlier in the course

48
00:02:24,630 --> 00:02:27,370
is that they are great for development

49
00:02:27,370 --> 00:02:30,610
so that you can mirror a certain folder

50
00:02:30,610 --> 00:02:33,330
on your host machine into a container.

51
00:02:33,330 --> 00:02:35,500
But that they're not really an option

52
00:02:35,500 --> 00:02:39,090
if you then also plan on deploying a container,

53
00:02:39,090 --> 00:02:41,120
something we're of course not doing yet,

54
00:02:41,120 --> 00:02:44,010
but which we will do in the deployment section

55
00:02:44,010 --> 00:02:46,400
right after this module.

56
00:02:46,400 --> 00:02:49,580
Because you're buying mountains, your local folders

57
00:02:49,580 --> 00:02:53,200
on your host machine are really only available there

58
00:02:54,081 --> 00:02:54,914
on your host machine.

59
00:02:54,914 --> 00:02:58,130
If you take this container, the server container let's say,

60
00:02:58,130 --> 00:03:00,400
and you put it onto Abra server,

61
00:03:00,400 --> 00:03:04,260
your source code, and this folder structure, won't be there.

62
00:03:04,260 --> 00:03:06,360
Sure, you could create it there

63
00:03:06,360 --> 00:03:08,570
but that's not the idea of containers

64
00:03:08,570 --> 00:03:11,860
that you then have to create a surrounding folder system.

65
00:03:11,860 --> 00:03:13,940
Instead, the idea behind containers

66
00:03:13,940 --> 00:03:16,220
is that everything a container needs

67
00:03:16,220 --> 00:03:18,730
is inside of that container.

68
00:03:18,730 --> 00:03:21,820
And the idea of bind mounts really is just

69
00:03:21,820 --> 00:03:24,690
that we can have an easier time during development,

70
00:03:24,690 --> 00:03:27,610
for example because our latest source code

71
00:03:27,610 --> 00:03:30,040
and our latest nginx configuration

72
00:03:30,040 --> 00:03:33,950
is always directly exposed to a container.

73
00:03:33,950 --> 00:03:37,970
The implication of that is that we might want to consider

74
00:03:37,970 --> 00:03:41,060
creating a docker file for this server

75
00:03:41,060 --> 00:03:43,610
and copying over our source code

76
00:03:43,610 --> 00:03:46,570
and our nginx configuration into that image

77
00:03:46,570 --> 00:03:48,910
so that besides that bind bound,

78
00:03:48,910 --> 00:03:50,900
which works during development

79
00:03:50,900 --> 00:03:54,480
we also already copy us snapshot of the source code

80
00:03:54,480 --> 00:03:57,000
and have our configuration in the image

81
00:03:57,000 --> 00:03:58,690
when it's being built.

82
00:03:58,690 --> 00:04:01,340
So that when we later deploy that image,

83
00:04:01,340 --> 00:04:03,850
it already contains all the source code

84
00:04:03,850 --> 00:04:05,993
and the configuration it needs.

