Introduction to Containers and CI/CD
Week 5 Assignment: Containerize and Ship a Data Pipeline
These exercises let you practice Docker, CI, and dependency management concepts from this week.
<aside> 📝 These exercises are optional. Use them to reinforce the concepts from this week before starting the assignment.
</aside>
Concepts: Dockerfile basics, environment variables.
Create a minimal pipeline script in src/pipeline.py:
import os
api_key = os.environ.get("API_KEY", "missing")
print(f"API key present: {api_key != 'missing'}")
Instructions:
pipeline-practice:1.0.API_KEY=demo and confirm the output changes.Concepts: Docker layers and caching with requirements.txt.
Instructions:
requirements.txt file with requests==2.31.0.requirements.txt first and installs dependencies before copying the rest of the source. You can use the script above as code. Build the docker image.Concepts: Docker layers and locked installs with uv.
Instructions:
pyproject.toml with requests==2.31.0.uv.lock.pyproject.toml and uv.lock first, installs uv, and runs uv sync --frozen --no-dev before copying the rest of the source.pyproject.toml, regenerate uv.lock, and build again. Confirm that the dependency layer now rebuilds.Concepts: requirements.txt vs uv in Docker.
Instructions:
uv sync --frozen is stricter than a plain dependency install from requirements.txt.Concepts: GitHub Actions, testing.
Instructions:
tests/test_smoke.py that asserts True.pytest -q.Concepts: -e, --env-file, ARG vs ENV.
Instructions:
.env file with API_KEY=demo and LOG_LEVEL=DEBUG.--env-file .env and confirm both values are read.ARG BUILD_SHA to your Dockerfile and pass it with --build-arg BUILD_SHA=abc123. Print it during the build.ARG values are not available at runtime.Concepts: Version tags.
Instructions:
dev, staging, and prod.docker images and confirm all three tags exist for the same Image ID.The HackYourFuture curriculum is licensed under CC BY-NC-SA 4.0 *https://hackyourfuture.net/*

Built with ❤️ by the HackYourFuture community · Thank you, contributors
Found a mistake or have a suggestion? Let us know in the feedback form.