1
00:00:02,240 --> 00:00:03,220
At this point,

2
00:00:03,220 --> 00:00:06,950
we are getting closer to the end of this module.

3
00:00:06,950 --> 00:00:10,690
We now also learned about multi-stage builds,

4
00:00:10,690 --> 00:00:13,680
and we saw how we can deploy multiple containers,

5
00:00:13,680 --> 00:00:16,160
not just on the same host,

6
00:00:16,160 --> 00:00:19,140
in the same task in ECS' case,

7
00:00:19,140 --> 00:00:21,840
but also on different hosts.

8
00:00:21,840 --> 00:00:23,070
And I'm saying host,

9
00:00:23,070 --> 00:00:24,690
because we have different domains

10
00:00:24,690 --> 00:00:27,033
for these different deployed containers.

11
00:00:28,050 --> 00:00:29,720
Now I also wanna verify

12
00:00:29,720 --> 00:00:32,750
whether everything still works correctly locally.

13
00:00:32,750 --> 00:00:34,510
With docker-compose up.

14
00:00:34,510 --> 00:00:36,763
Because that, hopefully, should still work.

15
00:00:37,640 --> 00:00:39,040
If I run this,

16
00:00:39,040 --> 00:00:41,360
and I enter localhost 3000,

17
00:00:41,360 --> 00:00:43,600
I still see my goals up there.

18
00:00:43,600 --> 00:00:45,310
And I got no goals here

19
00:00:45,310 --> 00:00:48,640
because we're using a different database in development.

20
00:00:48,640 --> 00:00:51,620
But I can add goals, and they stick around

21
00:00:51,620 --> 00:00:54,890
just in that development database.

22
00:00:54,890 --> 00:00:57,710
So that also seems to work just fine,

23
00:00:57,710 --> 00:00:59,670
and without any errors.

24
00:00:59,670 --> 00:01:04,000
Which is good, and which is of course exactly what we want.

25
00:01:04,000 --> 00:01:05,810
Now I also wanna talk about

26
00:01:05,810 --> 00:01:10,180
having different Docker files for production and development

27
00:01:10,180 --> 00:01:12,950
because at first, this might be strange.

28
00:01:12,950 --> 00:01:13,783
After all,

29
00:01:13,783 --> 00:01:16,150
one of the main reasons for using Docker

30
00:01:16,150 --> 00:01:18,510
was that we have the same environment

31
00:01:18,510 --> 00:01:21,530
in production and development.

32
00:01:21,530 --> 00:01:25,000
And I wanna emphasize that we still have that.

33
00:01:25,000 --> 00:01:26,730
Having the same environment

34
00:01:26,730 --> 00:01:29,730
does not mean that there can't be differences

35
00:01:29,730 --> 00:01:32,220
between production and development.

36
00:01:32,220 --> 00:01:34,030
In React's example,

37
00:01:34,030 --> 00:01:35,670
we need differences,

38
00:01:35,670 --> 00:01:38,190
because the code needs to be optimized.

39
00:01:38,190 --> 00:01:40,630
That's done automatically with a build script,

40
00:01:40,630 --> 00:01:43,210
but therefore we need a separate image

41
00:01:43,210 --> 00:01:45,850
that takes care about that build script

42
00:01:45,850 --> 00:01:47,450
and builds our code,

43
00:01:47,450 --> 00:01:49,060
before we serve it.

44
00:01:49,060 --> 00:01:50,930
There is no way around that,

45
00:01:50,930 --> 00:01:53,310
it's not a weakness in our setup,

46
00:01:53,310 --> 00:01:54,830
it is what we need to do

47
00:01:54,830 --> 00:01:56,553
for React projects.

48
00:01:57,840 --> 00:02:02,450
Things like using different URLs here in our React code,

49
00:02:02,450 --> 00:02:06,370
or different MONGODB database names,

50
00:02:06,370 --> 00:02:08,240
for development and production

51
00:02:08,240 --> 00:02:10,169
also are totally normal.

52
00:02:10,169 --> 00:02:12,950
This does not change the way our code works,

53
00:02:12,950 --> 00:02:15,260
and this does not change our environment.

54
00:02:15,260 --> 00:02:17,140
This is still a React app,

55
00:02:17,140 --> 00:02:20,790
and the backend is still executed with node.

56
00:02:20,790 --> 00:02:23,000
These are just differences in our code,

57
00:02:23,000 --> 00:02:24,540
which make a lot of sense.

58
00:02:24,540 --> 00:02:28,240
After all, we don't want to work on the production database

59
00:02:28,240 --> 00:02:30,650
when we're just testing our code.

60
00:02:30,650 --> 00:02:33,570
So you shouldn't make the mistake of thinking that

61
00:02:33,570 --> 00:02:37,660
just because there are some differences in code,

62
00:02:37,660 --> 00:02:41,510
or because we take care about different scenarios,

63
00:02:41,510 --> 00:02:43,888
like here with different backend URLs,

64
00:02:43,888 --> 00:02:46,200
that this would mean that all of a sudden

65
00:02:46,200 --> 00:02:48,710
we don't have that reproducibility.

66
00:02:48,710 --> 00:02:50,750
We absolutely do have it,

67
00:02:50,750 --> 00:02:51,920
because the code

68
00:02:51,920 --> 00:02:54,140
and the environment is still locked

69
00:02:54,140 --> 00:02:56,360
into an image and a container.

70
00:02:56,360 --> 00:02:58,590
And even if we have different images

71
00:02:58,590 --> 00:03:00,700
for development and production,

72
00:03:00,700 --> 00:03:02,640
as we have it here with React,

73
00:03:02,640 --> 00:03:06,580
we only have that because React forces us to do that.

74
00:03:06,580 --> 00:03:09,220
But our code is still the same.

75
00:03:09,220 --> 00:03:13,050
And React simply doesn't need any other environment tools,

76
00:03:13,050 --> 00:03:16,700
it doesn't need node just to execute the code.

77
00:03:16,700 --> 00:03:19,250
It just needs node to build the code,

78
00:03:19,250 --> 00:03:21,140
and therefore we have code,

79
00:03:21,140 --> 00:03:22,670
both in the development,

80
00:03:22,670 --> 00:03:25,940
as well as in the production environment.

81
00:03:25,940 --> 00:03:29,190
And of course we could use the exact same node version

82
00:03:29,190 --> 00:03:30,730
in both Docker files,

83
00:03:30,730 --> 00:03:32,770
if we really wanted to ensure

84
00:03:32,770 --> 00:03:35,120
that we have the exact same setup.

85
00:03:35,120 --> 00:03:37,130
So let's maybe do that here.

86
00:03:37,130 --> 00:03:39,280
That's just something I wanted to emphasize,

87
00:03:39,280 --> 00:03:41,770
because it's easy to get confused by that,

88
00:03:41,770 --> 00:03:43,660
and to think that, well,

89
00:03:43,660 --> 00:03:47,550
all of a sudden we're not using Docker's benefits anymore.

90
00:03:47,550 --> 00:03:49,063
We definitely are.

