Skip to content

Commit 4b53f43

Browse files
committed
start addressing some issues in 10, incl some of those in #281
1 parent 68f3c1c commit 4b53f43

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

chapter_10_production_readiness.asciidoc

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,13 @@ Let's change the command our image runs:
126126
[source,dockerfile]
127127
----
128128
[...]
129-
RUN pip install "django<5" gunicorn <1>
129+
RUN pip install "django<5" gunicorn # <1>
130130
131131
COPY src /src
132132
133133
WORKDIR /src
134134
135-
CMD gunicorn --bind :8888 superlists.wsgi:application <2>
135+
CMD gunicorn --bind :8888 superlists.wsgi:application # <2>
136136
----
137137
====
138138
// CSANAD: shouldn't we try it out before adding this to the Dockerfile?
@@ -230,9 +230,6 @@ MIDDLEWARE = [
230230
// CSANAD: I would add a few thoughts on the significance of the order of
231231
// middlewares.
232232

233-
And if you take another manual look at your site after rebuilding the
234-
container, things should look much healthier.
235-
236233
And then we need to add it to our pip installs in the Dockerfile:
237234

238235
.Dockerfile (ch10l003)
@@ -374,11 +371,8 @@ whitenoise==6.6.0
374371

375372
That's a good first cut, let's commit it:
376373

377-
// SEBASTIAN I am not very fond of freezing just "top-level" dependencies of the project,
378-
// . This is not guaranteeing the reproducible builds and I failed to build & deploy because of that more than once.
379-
// But I understand it's a trade-off so the reader does get bogged down.
380-
// TODO: add a note about this and a link to some more reading
381374

375+
[subs="specialcharacters,quotes"]
382376
----
383377
$ *git add requirements.txt*
384378
$ *git commit -m "Add a requirements.txt with Django, gunicorn and whitenoise"*
@@ -420,14 +414,14 @@ FROM python:slim
420414
RUN python -m venv /venv
421415
ENV PATH="/venv/bin:$PATH"
422416
423-
COPY requirements.txt requirements.txt <1>
424-
RUN pip install -r requirements.txt <2>
417+
COPY requirements.txt requirements.txt # <1>
418+
RUN pip install -r requirements.txt # <2>
425419
426420
COPY src /src
427421
428422
WORKDIR /src
429423
430-
CMD python manage.py runserver
424+
CMD gunicorn --bind :8888 superlists.wsgi:application
431425
----
432426
====
433427

@@ -451,6 +445,7 @@ TIP: Forgetting the `-r` and running `pip install requirements.txt`
451445
// and then setting the user in the Dockerfile with `USER todoapp`.
452446
// But we can cover this in a later chapter (the next one looks like a good fit,
453447
// since it's related to the app being production ready).
448+
// TODO yep let's definitely do this.
454449

455450
Let's do a build & run & test to check everything still works:
456451

@@ -552,6 +547,7 @@ TIP: Better to fail hard than allow a typo in an environment variable name to
552547
// in a development environment relying on containerization, programmers usually
553548
// mount the whole /src minimizing the time-consuming rebuilding of their images.
554549

550+
555551
==== Setting environment variables inside the Dockerfile
556552

557553
Now let's set that environment variable in our Dockerfile using the `ENV` directive:

0 commit comments

Comments
 (0)