7.1 What docker build leaves out
Build it yourself. Read the tutorial is the other way to read this part.
This walk goes through rahuldave/cheesecracker on GitHub. This part starts from the code at step-06. The code before this part
If you start at this part, make your clone as Get the project says, and then run this command. It puts in your clone the files that this part starts from. A file that the project deleted before this part stays, so delete it if git check lists it:
git fetch --quiet --tags --force origin; git rm -rq --cached --ignore-unmatch -- :/ && git restore --source step-06 --staged --worktree -- :/just setupOur first file for Docker, .dockerignore, lists the files that never go into an image.
7.1 what docker build leaves out
Docker runs programs in containers. A container is a process with its own files, cut off
from the rest of the machine. A Dockerfile lists the instructions that build an image. It starts from a base system, such
as Debian with Python, and adds the files and the commands. docker build makes the image, and docker run starts a
container from it. On macOS and Windows, the app Docker Desktop runs Docker.
docker build sends the files of the folder to Docker. The folder has .venv, the caches of the tools, git and maybe
secrets. None of them belongs in an image. .dockerignore lists them.
Apply the patch to .dockerignore, from the top of the project:
curl -fsSL https://github.com/rahuldave/cheesecracker/commit/2a28a5c704d6d9ed8200aeb8962aa01e5c2ac552.diff | git apply --include=.dockerignoreApply the patch, and read its list.
cat .dockerignorecat prints the list.
Check your files against this move. The command prints nothing when they match, and otherwise shows what differs:
git check 2a28a5c704d6If you are stuck, this command puts the files of this move in place of yours. A file that you made yourself stays:
git fetch --quiet --tags --force origin; git restore --source step-06 --staged -- :/ && git restore --source 2a28a5c704d6 --staged --worktree -- :/What changed
.dockerignore: whatdocker buildnever sends to Docker. New, 10 lines. The file- look at
.venv/
- look at
The patch to .dockerignore
@@ -0,0 +1,10 @@
+# What docker build never sends to Docker: the environment, the caches, git and the secrets
+.venv/
+__pycache__/
+.pytest_cache/
+.ruff_cache/
+.coverage
+htmlcov/
+.git/
+secrets/
+.envThis part ends at the code at 2a28a5c704d6, partway through step-07. The code after this part