Skip to content

Commit e8abda8

Browse files
committed
start bringing chap 9 under test
1 parent b974b0c commit e8abda8

File tree

3 files changed

+35
-34
lines changed

3 files changed

+35
-34
lines changed

chapter_09_docker.asciidoc

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
[[chapter_09_docker]]
22
== Containerization aka Docker
3-
// RITA: I'm not keen on including the word "part" in chapter titles
4-
// especially when the chapter is also within something called a "part."
5-
// Would it make sense to put the deployment chapters into its own Part?
6-
// So, ch8 might go into Part 1,
7-
// chs 9-11 would go into the new Part 2 called something like "Deployment,"
8-
// and Part 3 would start with ch 12.
3+
94

105
.A Note for Early Release Readers
116
****
@@ -431,7 +426,7 @@ test_can_start_a_todo_list
431426
[...]
432427
433428
selenium.common.exceptions.WebDriverException: Message: Reached error page: abo
434-
ut:neterror?e=connectionFailure&u=http%3A//localhost:8888/[...]
429+
ut:neterror?e=connectionFailure&u=http%3A//localhost%3A8888/[...]
435430
436431
437432
Ran 1 tests in 5.518s
@@ -499,9 +494,9 @@ The https://docs.docker.com/get-docker/[Docker documentation] is pretty good,
499494
and you'll find detailed installation instructions for Windows, Mac, and Linux.
500495
Follow those, and then test your installation by running:
501496

502-
[subs="specialcharacters,quotes"]
497+
[subs="specialcharacters,macros"]
503498
----
504-
$ *docker run busybox echo hello world*
499+
$ pass:quotes[*docker run busybox echo hello world*]
505500
Unable to find image 'busybox:latest' locally
506501
[...]
507502
latest: Pulling from library/busybox
@@ -595,17 +590,20 @@ next to the `src/` directory we made earlier:
595590
// 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)
596591
// JAN: I'd use Docker comments with # for <1>, <2>, ... Otherwise, you need to edit the code when you paste it
597592

593+
594+
595+
[role="sourcecode"]
598596
.Dockerfile (ch09l003)
599597
====
600598
[source,dockerfile]
601599
----
602-
FROM python:slim <1>
600+
FROM python:slim # <1>
603601
604-
COPY src /src <2>
602+
COPY src /src # <2>
605603
606-
WORKDIR /src <3>
604+
WORKDIR /src # <3>
607605
608-
CMD python manage.py runserver <4>
606+
CMD python manage.py runserver # <4>
609607
----
610608
====
611609

@@ -644,14 +642,16 @@ next to our `Dockerfile`:
644642
.
645643
├── Dockerfile
646644
├── db.sqlite3
647-
└── src
648-
├── functional_tests
649-
│   ├── [...]
650-
├── lists
651-
│   ├── [...]
652-
├── manage.py
653-
└── superlists
654-
├── [...]
645+
├── src
646+
│   ├── functional_tests
647+
│   │   ├── [...]
648+
│   ├── lists
649+
│   │   ├── [...]
650+
│   ├── manage.py
651+
│   └── superlists
652+
│   ├── [...]
653+
└── static
654+
└── [...]
655655
----
656656
====
657657
@@ -675,7 +675,7 @@ $ pass:quotes[*docker build -t superlists .*]
675675
=> => transferring dockerfile: 115B 0.0s
676676
=> [internal] load .dockerignore 0.1s
677677
=> => transferring context: 2B 0.0s
678-
=> [internal] load metadata for docker.io/library/python:slim 0.0s
678+
=> [internal] load metadata for docker.io/library/python:slim 3.4s
679679
=> [internal] load build context 0.2s
680680
=> => transferring context: 68.54kB 0.1s
681681
=> [1/3] FROM docker.io/library/python:slim 0.0s
@@ -695,9 +695,9 @@ Now we can see our image in the list of docker images on the system:
695695
[subs="specialcharacters,quotes"]
696696
----
697697
$ *docker images*
698-
REPOSITORY TAG IMAGE ID CREATED SIZE
698+
REPOSITORY TAG IMAGE ID CREATED SIZE
699699
[...]
700-
superlists latest 7b8e1c9fa68e 13 minutes ago 155MB
700+
superlists latest 522824a399de 2 minutes ago 164MB
701701
----
702702
703703

tests/test_chapter_09_docker.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,24 @@ def test_listings_and_commands_and_output(self):
1616
self.assertEqual(self.listings[0].type, "code listing with git ref")
1717
self.assertEqual(self.listings[1].type, "test")
1818

19+
# skips
20+
self.skip_with_check(20, "naming to docker.io/library/superlists")
21+
1922
self.start_with_checkout()
23+
# simulate having a db.sqlite3 and a static folder from previous chaps
24+
self.sourcetree.run_command("./manage.py migrate --noinput")
25+
self.sourcetree.run_command("./manage.py collectstatic --noinput")
2026

2127
vm_restore = None # 'MANUAL_1'
2228

2329
# hack fast-forward
24-
skip = False
30+
skip = True
2531
if skip:
26-
# self.pos = 8
27-
# self.sourcetree.run_command('git checkout {0}'.format(
28-
# self.sourcetree.get_commit_spec('ch08l001')
29-
# ))
30-
self.pos = 43
31-
self.current_server_cd = "~/sites/$SITENAME"
32+
self.pos = 8
3233
self.sourcetree.run_command(
33-
"git checkout {0}".format(self.sourcetree.get_commit_spec("ch08l004"))
34+
"git checkout {}".format(self.sourcetree.get_commit_spec("ch09l001"))
3435
)
35-
vm_restore = "MANUAL_2"
36+
# vm_restore = "MANUAL_2"
3637

3738
if DO_SERVER_COMMANDS:
3839
if vm_restore:

0 commit comments

Comments
 (0)