Week 5 - Containers & CI/CD

Introduction to Containers and CI/CD

Dependency Management

Docker Fundamentals

Azure Container Registry

Python CI Pipeline

Week 5 Gotchas & Pitfalls

Practice

Week 5 Assignment: Containerize and Ship a Data Pipeline

Week 5 Lesson Plan

๐ŸŽ’ Week 5 Assignment: Containerize and Ship a Data Pipeline

In Week 3 you built a robust ingestion pipeline. In Week 4 you processed data with Pandas. Now you will package that pipeline as a container and automate its delivery to Azure Container Registry.

Your goal is to make your pipeline reproducible and deployable with one CI workflow.

Task 1: Choose a Pipeline

Pick one pipeline you already built:

Copy the code into a new assignment folder and make sure it runs locally.

<aside> ๐Ÿ’ก Choose the pipeline you understand best. You will debug it inside a container.

</aside>

Task 2: Define Dependencies

Create a requirements.txt or a pyproject.toml with pinned versions. Your pipeline must run in a clean virtual environment.

<aside> โš ๏ธ If you rely on system-wide packages, your container will fail in CI.

</aside>

Task 3: Write a Dockerfile

Create a Dockerfile that:

  1. Uses Python 3.11
  2. Installs dependencies
  3. Copies your source code
  4. Runs the pipeline

Test it locally with docker build and docker run.

Task 4: Add Configuration

Move any secrets or runtime values into environment variables. Your container must read configuration from the environment, not from hardcoded values.

<aside> โŒจ๏ธ Hands on: Run your container with a missing env var and confirm it fails fast with a clear error.

</aside>

Task 5: Build a CI Workflow

Create .github/workflows/ci.yml that:

  1. Installs dependencies
  2. Runs ruff (see Python CI Pipeline)
  3. Runs pytest (see Testing with pytest, Week 2)
  4. Builds the Docker image

Task 6: Push to Azure Container Registry

Use GitHub Actions to push your image to ACR. The workflow should tag the image with the Git commit SHA.

Task 7: AI Assist Report

Create a short file AI_ASSIST.md and describe:

Deliverables

You must submit:

Technical Requirements

week5-container-assignment/
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ ci.yml
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ pipeline.py
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ test_pipeline.py
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ AI_ASSIST.md

Evaluation Criteria

Your assignment will be evaluated on:

Extra reading

Submission

  1. Create a git branch week5/your-name.
  2. Commit your work with a clear message.
  3. Push the branch and open a Pull Request.

The HackYourFuture curriculum is licensed underย CC BY-NC-SA 4.0 *https://hackyourfuture.net/*

CC BY-NC-SA 4.0 Icons

Built with โค๏ธ by the HackYourFuture community ยท Thank you, contributors

Found a mistake or have a suggestion? Let us know in the feedback form.