Commit 438b8af
authored
Reworked docker docs (nhs-england-tools#155)
<!-- markdownlint-disable-next-line first-line-heading -->
## Description
Minor (but important!) changes to how docker is run, `DOCKER_IMAGE`
handling, and some docs.
## Context
This change wraps up a few different changes I needed to make when using
the template.
### Docker context
[Here](https://github.com/nhs-england-tools/repository-template/compare/alyo12-docker-docs?expand=1#diff-dddd47b45acd050e3b06771b95c68eee8ebcbfcf8a019b3f0186725a18cfcab6L33)
we were `cd`ing into the `infrastructure/images/whatever` directory
before running Docker. That restricts the docker context to only that
directory and below. You can't `COPY ../../. .` or whatever because
that's treated as a security problem.
This meant that you couldn't put your application code into a container
inside the `infrastructure/images` structure. That's fine if you've got
a single application container, and if you're happy with it living at
the root of the repo, but as soon as you've got more than one it gets a
bit messy (and I've never liked things that clutter the repo root at the
best of times).
The change I've made gets rid of the `cd` in and out; `docker` is
*always* run from the repo root. That means paths in `Dockerfile`s are
relative to the root, not to themselves; same with `.dockerignore`
(which I've made optional so that it doesn't break if there isn't one).
### `$DOCKER_IMAGE` variable handling
Minor tweak but a good quality of life improvement here. If you specify
`$DOCKER_IMAGE` to the `make docker-*` tasks but *not* `$dir` then it
defaults `$dir` to `infrastructure/images/$DOCKER_IMAGE`. That means the
`make` invocation, the filesystem, and the docker image list are all
synchronised to the same name, by convention.
### Updated docker usage docs
The example in the existing docs was specific to repackaging a third
party tool, but gave no guidance about how to package your own
application code. I've rewritten the `Quick start` section to show
packaging a trivial python script. I'm a little worried that the docs
are a bit repetitive now, but I don't think it's worth reworking right
now.
I've also removed the python example code. It was a good start, but in
practice having the tutorial docs is better because what I want to know
as a new user is *where to put my own stuff*, and the example wasn't a
huge help there and in fact was a bit of a confusion.
## Type of changes
<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply. -->
- [x] Refactoring (non-breaking change)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would change existing
functionality)
- [ ] Bug fix (non-breaking change which fixes an issue)
## Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply. -->
- [ ] I am familiar with the [contributing
guidelines](../docs/CONTRIBUTING.md)
- [ ] I have followed the code style of the project
- [ ] I have added tests to cover my changes
- [ ] I have updated the documentation accordingly
- [ ] This PR is a result of pair or mob programming
---
## Sensitive Information Declaration
To ensure the utmost confidentiality and protect your and others
privacy, we kindly ask you to NOT including [PII (Personal Identifiable
Information) / PID (Personal Identifiable
Data)](https://digital.nhs.uk/data-and-information/keeping-data-safe-and-benefitting-the-public)
or any other sensitive data in this PR (Pull Request) and the codebase
changes. We will remove any PR that do contain any sensitive
information. We really appreciate your cooperation in this matter.
- [ ] I confirm that neither PII/PID nor sensitive data are included in
this PR and the codebase changes.1 parent abd2548 commit 438b8af
File tree
11 files changed
+171
-197
lines changed- docs/developer-guides
- scripts
- config
- docker
- examples/python
- assets/hello_world
- tests
11 files changed
+171
-197
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
46 | | - | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | 66 | | |
68 | 67 | | |
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
72 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
73 | 130 | | |
74 | 131 | | |
75 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
76 | 138 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
81 | 143 | | |
82 | 144 | | |
83 | | - | |
| 145 | + | |
84 | 146 | | |
85 | 147 | | |
86 | | - | |
| 148 | + | |
| 149 | + | |
87 | 150 | | |
88 | | - | |
89 | | - | |
90 | | - | |
| 151 | + | |
91 | 152 | | |
92 | | - | |
| 153 | + | |
93 | 154 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
101 | 159 | | |
102 | 160 | | |
| 161 | + | |
| 162 | + | |
103 | 163 | | |
104 | 164 | | |
105 | | - | |
| 165 | + | |
106 | 166 | | |
107 | | - | |
| 167 | + | |
108 | 168 | | |
109 | 169 | | |
110 | 170 | | |
| |||
212 | 272 | | |
213 | 273 | | |
214 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
215 | 279 | | |
216 | 280 | | |
217 | 281 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
3 | 9 | | |
4 | 10 | | |
5 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
| |||
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
46 | | - | |
| 45 | + | |
47 | 46 | | |
48 | 47 | | |
49 | 48 | | |
50 | | - | |
| 49 | + | |
51 | 50 | | |
52 | 51 | | |
53 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
54 | 55 | | |
55 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
56 | 75 | | |
57 | 76 | | |
58 | 77 | | |
| |||
81 | 100 | | |
82 | 101 | | |
83 | 102 | | |
| 103 | + | |
84 | 104 | | |
85 | 105 | | |
86 | 106 | | |
87 | 107 | | |
88 | | - | |
89 | | - | |
| 108 | + | |
| 109 | + | |
90 | 110 | | |
91 | 111 | | |
92 | 112 | | |
| |||
114 | 134 | | |
115 | 135 | | |
116 | 136 | | |
117 | | - | |
| 137 | + | |
| 138 | + | |
118 | 139 | | |
119 | 140 | | |
120 | 141 | | |
| |||
207 | 228 | | |
208 | 229 | | |
209 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
210 | 238 | | |
211 | 239 | | |
212 | 240 | | |
| |||
276 | 304 | | |
277 | 305 | | |
278 | 306 | | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
279 | 321 | | |
280 | 322 | | |
281 | 323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | | - | |
11 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
12 | 23 | | |
13 | 24 | | |
14 | 25 | | |
15 | 26 | | |
16 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
17 | 32 | | |
18 | 33 | | |
19 | 34 | | |
20 | 35 | | |
21 | 36 | | |
22 | 37 | | |
23 | | - | |
24 | | - | |
| 38 | + | |
25 | 39 | | |
26 | | - | |
27 | 40 | | |
28 | 41 | | |
29 | 42 | | |
| |||
40 | 53 | | |
41 | 54 | | |
42 | 55 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | 56 | | |
72 | 57 | | |
73 | 58 | | |
74 | 59 | | |
75 | 60 | | |
| 61 | + | |
76 | 62 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 63 | + | |
81 | 64 | | |
| 65 | + | |
82 | 66 | | |
83 | 67 | | |
This file was deleted.
0 commit comments