

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Managing Secrets
incomplete
2: Injecting Secrets at Runtime
incomplete
3: Protecting Secrets
incomplete
4: Build Artifacts and Deployment Hygiene
incomplete
5: Limiting Build Context
incomplete
6: Source Code and Config Leaks
incomplete
7: Public File Leaks
incomplete
8: Server-Side Request Forgery
incomplete
9: Defending Against SSRF
incomplete
10: Open Redirects
incomplete
11: Risks of Dependencies
incomplete
12: Auditing Dependencies
incomplete
13: Dependency Maintenance
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
A .dockerignore file removes files from the build context before Docker sends it to the builder. Ignored local data never becomes available to Dockerfile instructions.
A useful ignore file targets files that are local, generated, sensitive, or irrelevant to production, not source files the build needs:
.env*
.git/
tmp/
*.log
data/*.sqlite*
data/uploads/*
!data/uploads/sample-document.pdf
The Dockerfile and .dockerignore solve different problems:
.dockerignore controls what the builder can see.Use both boundaries. A narrow Dockerfile doesn't justify sending secrets to the builder, and a strong .dockerignore doesn't make COPY . . precise.
Bearly Secure's narrow Dockerfile still sends the entire project to the builder. Add a .dockerignore that limits the build context without removing required inputs.
docker build -t bearly-secure .
docker run --rm --entrypoint test bearly-secure -f /app/data/uploads/mystery-shack-tax-exemption.pdf
Run and submit the CLI tests from the project root.