Skip to content

Commit 3f4d3d7

Browse files
authored
Merge pull request #216 from hjwp/20240328_jg_chapter_09_review
Review chapter_09_docker.asciidoc
2 parents 43c3c21 + b4ee385 commit 3f4d3d7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

chapter_09_docker.asciidoc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,8 @@ What do we need to do? Something like this, right?
559559
We create a new file called _Dockerfile_ in the base folder of our repo,
560560
next to the `src/` directory we made earlier:
561561

562+
// JAN: I'd suggest to use python3.11:slim or python3:12 slim. Keeping image tags too open leads to issues in a couple of months (not always, but waaay too often)
563+
// JAN: I'd use Docker comments with # for <1>, <2>, ... Otherwise, you need to edit the code when you paste it
562564

563565
.Dockerfile (ch09l003)
564566
====
@@ -808,7 +810,7 @@ with `docker ps`:
808810
809811
[role="skipme small-code"]
810812
----
811-
$ *docker ps
813+
$ *docker ps*
812814
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
813815
0818e1b8e9bf superlists "/bin/sh -c 'python …" 4 seconds ago Up 4 seconds hardcore_moore
814816
----
@@ -1240,7 +1242,7 @@ NOTE: If you don't see this error,
12401242
and you should be able to reproduce the error. I promise it's instructive!
12411243
12421244
1243-
==== Should we run "migrate" inside the Dockerfile? No.
1245+
==== Should we run "migrate" inside the Dockerfile? No. // JAN: Not sure I understand this line. You're saying that we shouldn't run migrate inside our Dockerfile, but then in the next line you do exactly that
12441246
12451247
So, should we include `manage.py migrate` in our Dockerfile?
12461248
@@ -1255,14 +1257,14 @@ If you try it, you'll find it certainly fixes the problem:
12551257
WORKDIR /src
12561258

12571259
RUN python manage.py migrate --noinput <1>
1258-
CMD python manage.py runserver
1260+
CMD python manage.py runserver 0.0.0.0:8888
12591261
----
12601262
====
12611263
12621264
<1> We run `migrate` using the `--noinput` argument to suppress any little "are you sure" prompts.
12631265
12641266
1265-
If we try our FTs again, they all pass!
1267+
If we try our FTs again, they all pass! // JAN: That's not true. One needs to rebuild the Docker image and start a new container
12661268
12671269
12681270
[role="small-code"]
@@ -1305,13 +1307,11 @@ First let's revert our change:
13051307
[...]
13061308
WORKDIR /src
13071309

1308-
CMD python manage.py runserver
1310+
CMD python manage.py runserver 0.0.0.0:8888
13091311
----
13101312
====
13111313
13121314
1313-
1314-
13151315
Let's start by re-creating the database with `migrate`
13161316
(when we moved everything into `./src`, we left the database file behind):
13171317

0 commit comments

Comments
 (0)