Skip to content

Commit 7cdebb7

Browse files
tasxatzialBNAndraskotpIsaacG
authored
Revise best-practices.md (#569)
* Fix grammar issues in best-practices.md * add suggestions from review * Apply suggestions from code review Co-authored-by: András B Nagy <[email protected]> * Apply final suggestion * Change second 'libraries' reference to 'dependencies' Co-authored-by: Victor Goff <[email protected]> * Apply suggestions from code review Co-authored-by: Isaac Good <[email protected]> --------- Co-authored-by: András B Nagy <[email protected]> Co-authored-by: Victor Goff <[email protected]> Co-authored-by: Isaac Good <[email protected]>
1 parent e5fa88b commit 7cdebb7

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

building/tooling/best-practices.md

+12-11
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,19 @@ See the [network docs](/docs/building/tooling/docker#network) for more informati
4646

4747
### Prefer build-time commands over run-time commands
4848

49-
Tooling runs as one-off, short-lived Docker container:
49+
The track tooling runs a one-off, short-lived Docker container which executes the following steps.
5050

51-
1. A Docker container is created
52-
2. The Docker container is run with the correct arguments
53-
3. The Docker container is destroyed
51+
1. A Docker container is created.
52+
2. The Docker container is run with the correct arguments.
53+
3. The Docker container is destroyed.
5454

5555
Therefore, code that runs in step 2 runs for _every single tooling run_.
56-
For this reason, reducing the amount of code that runs in step 2 is a great way to improve performance
56+
For this reason, reducing the amount of code that runs in step 2 is a great way to improve performance.
5757
One way of doing this is to move code from _run-time_ to _build-time_.
5858
Whilst run-time code runs on every single tooling run, build-time code only runs once (when the Docker image is built).
5959

6060
Build-time code runs once as part of a GitHub Actions workflow.
61-
Therefore, its fine if the code that runs at build-time is (relatively) slow.
61+
Therefore, it's fine if the code that runs at build-time is (relatively) slow.
6262

6363
#### Example: pre-compile libraries
6464

@@ -72,10 +72,11 @@ RUN stack build --resolver lts-20.18 --no-terminal --test --no-run-tests
7272
```
7373

7474
First, the `pre-compiled` directory is copied into the image.
75-
This directory is setup as a sort of fake exercise and depends on the same base libraries that the actual exercise depend on.
75+
This directory is set up as a test exercise and depends on the same base libraries that the actual exercise depends on.
7676
Then we run the tests on that directory, which is similar to how tests are run for an actual exercise.
7777
Running the tests will result in the base being compiled, but the difference is that this happens at _build time_.
78-
The resulting Docker image will thus have its base libraries already compiled, which means that no longer has to happen at _run time_, resulting in (much) faster execution times.
78+
The resulting Docker image will thus have its base libraries already compiled.
79+
This means compiling is not needed at _run time_, resulting in a (much) faster execution.
7980

8081
#### Example: pre-compile binaries
8182

@@ -117,7 +118,7 @@ node 20.16.0 1.09GB
117118
node 20.16.0-slim 219MB
118119
```
119120

120-
The reason "slim" variants are smaller is that they'll have less features.
121+
The reason "slim" variants are smaller is that they have fewer features.
121122
Your image might not need the additional features, and if not, consider using the "slim" variant.
122123

123124
### Removing unneeded bits
@@ -137,7 +138,7 @@ Therefore, any package manager caching/bookkeeping files should be removed after
137138

138139
##### apk
139140

140-
Distributions that uses the `apk` package manager (such as Alpine) should use the `--no-cache` flag when using `apk add` to install packages:
141+
Distributions that use the `apk` package manager (such as Alpine) should use the `--no-cache` flag when using `apk add` to install packages:
141142

142143
```dockerfile
143144
RUN apk add --no-cache curl
@@ -214,7 +215,7 @@ ENTRYPOINT ["/opt/test-runner/bin/run.sh"]
214215
##### Example: installing libraries
215216

216217
The Ruby test runner needs the `git`, `openssh`, `build-base`, `gcc` and `wget` packages to be installed before its required libraries (gems) can be installed.
217-
Its [Dockerfile](https://github.com/exercism/ruby-test-runner/blob/e57ed45b553d6c6411faeea55efa3a4754d1cdbf/Dockerfile) starts with a stage (given the name `build`) that install those packages (via `apk add`) and then installs the libaries (via `bundle install`):
218+
Its [Dockerfile](https://github.com/exercism/ruby-test-runner/blob/e57ed45b553d6c6411faeea55efa3a4754d1cdbf/Dockerfile) starts with a stage (given the name `build`) that installs those packages (via `apk add`) and then installs the dependencies (via `bundle install`):
218219

219220
```dockerfile
220221
FROM ruby:3.2.2-alpine3.18 AS build

0 commit comments

Comments
 (0)