Summary
The db/Dockerfile is completely empty — it contains no instructions. Docker builds a blank intermediate layer and docker-compose uses it as the MongoDB service. The commented-out line in docker-compose.yml already suggests the correct approach: use the official mongo image directly.
Background
An empty Dockerfile is misleading and fragile. It works only because Docker falls back to scratch, but the resulting image is the python:3.11-slim base image without MongoDB binaries — it relies on Docker's layer cache or the host having pulled mongo previously. This is non-deterministic and confusing for learners.
Affected Areas
db/Dockerfile — empty file
docker-compose.yml — my_db service build directive
Recommended Fix
Remove db/Dockerfile and update docker-compose.yml:
my_db:
image: mongo:7.0
restart: unless-stopped
Delete the db/ directory entirely if no other files are present.
Acceptance Criteria
Complexity Estimate
XS — two-line compose change, file deletion.
Priority
Medium — currently non-deterministic behaviour that silently works on some machines and fails on others.
Auto-identified by workspace issue-logger
Category: coding standards / style / linting
Complexity: XS
Repository: DewaldOosthuizen/python_rest_tutorial
Summary
The
db/Dockerfileis completely empty — it contains no instructions. Docker builds a blank intermediate layer anddocker-composeuses it as the MongoDB service. The commented-out line indocker-compose.ymlalready suggests the correct approach: use the officialmongoimage directly.Background
An empty Dockerfile is misleading and fragile. It works only because Docker falls back to scratch, but the resulting image is the
python:3.11-slimbase image without MongoDB binaries — it relies on Docker's layer cache or the host having pulledmongopreviously. This is non-deterministic and confusing for learners.Affected Areas
db/Dockerfile— empty filedocker-compose.yml—my_dbservicebuilddirectiveRecommended Fix
Remove
db/Dockerfileand updatedocker-compose.yml:Delete the
db/directory entirely if no other files are present.Acceptance Criteria
db/Dockerfileremovedmy_dbservice usesimage: mongo:7.0(or latest stable)docker-compose upstarts MongoDB correctly/helloand/registerendpoints respond as expectedComplexity Estimate
XS — two-line compose change, file deletion.
Priority
Medium — currently non-deterministic behaviour that silently works on some machines and fails on others.
Auto-identified by workspace issue-logger
Category: coding standards / style / linting
Complexity: XS
Repository: DewaldOosthuizen/python_rest_tutorial