You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: chapter_09_docker.asciidoc
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -559,6 +559,8 @@ What do we need to do? Something like this, right?
559
559
We create a new file called _Dockerfile_ in the base folder of our repo,
560
560
next to the `src/` directory we made earlier:
561
561
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
562
564
563
565
.Dockerfile (ch09l003)
564
566
====
@@ -808,7 +810,7 @@ with `docker ps`:
808
810
809
811
[role="skipme small-code"]
810
812
----
811
-
$ *docker ps
813
+
$ *docker ps*
812
814
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
813
815
0818e1b8e9bf superlists "/bin/sh -c 'python …" 4 seconds ago Up 4 seconds hardcore_moore
814
816
----
@@ -1240,7 +1242,7 @@ NOTE: If you don't see this error,
1240
1242
and you should be able to reproduce the error. I promise it's instructive!
1241
1243
1242
1244
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
1244
1246
1245
1247
So, should we include `manage.py migrate` in our Dockerfile?
1246
1248
@@ -1255,14 +1257,14 @@ If you try it, you'll find it certainly fixes the problem:
1255
1257
WORKDIR /src
1256
1258
1257
1259
RUN python manage.py migrate --noinput <1>
1258
-
CMD python manage.py runserver
1260
+
CMD python manage.py runserver 0.0.0.0:8888
1259
1261
----
1260
1262
====
1261
1263
1262
1264
<1> We run `migrate` using the `--noinput` argument to suppress any little "are you sure" prompts.
1263
1265
1264
1266
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
1266
1268
1267
1269
1268
1270
[role="small-code"]
@@ -1305,13 +1307,11 @@ First let's revert our change:
1305
1307
[...]
1306
1308
WORKDIR /src
1307
1309
1308
-
CMD python manage.py runserver
1310
+
CMD python manage.py runserver 0.0.0.0:8888
1309
1311
----
1310
1312
====
1311
1313
1312
1314
1313
-
1314
-
1315
1315
Let's start by re-creating the database with `migrate`
1316
1316
(when we moved everything into `./src`, we left the database file behind):
0 commit comments