Skip to main content
Welcome back! Now that your Flask application is running locally, it’s time to containerize it with Docker and push your code to GitHub. This guide walks you through creating a Dockerfile, staging and committing changes, working with feature branches, and opening a pull request.

Preparing the Dockerfile

In VS Code (or your preferred editor), create a file named Dockerfile in your project root:
This Dockerfile installs dependencies, copies your application code, and starts the Flask development server on all interfaces (0.0.0.0).
Use --no-cache-dir with pip to reduce image size by preventing caching of package files.

Staging and Committing Changes

Once your Dockerfile, app.py, requirements.txt, and README.md are ready, stage all modified and new files:
Commit with a clear, descriptive message:
Expected output:
Confirm you’re on the main branch:
Output:
Make sure sensitive files (e.g., .env, keys) are listed in your .gitignore to avoid accidental commits.

Branching and Pushing Feature Branch

Follow Git best practices by working in a feature branch named after your JIRA task:
  1. Create and switch to the branch:
  2. Push the branch to GitHub:
You should see:

Opening a Pull Request

  1. Navigate to your GitHub repository in a browser.
  2. Click Compare & pull request for sprint-01/jira-id-0202.
  3. Add a title and paste your commit message in the description.
  4. Assign a reviewer from your team.
The image shows a GitHub pull request page for a Python application, with details about the branches involved, comments, and options to merge the pull request.
Once the PR is approved, click Merge pull request, then Confirm merge. Finally, switch back to main and pull the latest changes:
Your main branch now contains the merged feature.

Next Steps

With Sprint 01 completed, we’ll proceed to the sprint review—covering objectives, demos, and feedback. Stay tuned!

Watch Video