Menu

1 / 2

Building a CI/CD Pipeline with GitHub Actions and Trivy for a Dockerized Flask API

DEV Community: docker·Edith Ogechi Odo·about 2 hours ago
#VVN2LsHW
#devtodocker#devto#dev#docker#github
Reading 0:00
15s threshold

After containerizing the Task Management API, the next stage of my DevOps capstone was automating the application build and delivery process.

The goal was to reduce manual work, introduce automated testing, build Docker images, and scan images for vulnerabilities before publishing them.

For this stage, I worked with GitHub Actions, Docker Hub, and Trivy.

Understanding the CI/CD Architecture

The pipeline was designed to start whenever changes were pushed to the GitHub repository.

Architecture components

GitHub: Hosts the source code.

GitHub Actions: Automates the pipeline.

Pytest: Runs automated application tests.

Docker: Builds the application image.

Trivy:Scans the image for vulnerabilities.

Docker Hub:Stores the published image.

GitHub Secrets: Stores sensitive credentials.

Preparing the GitHub Repository

I prepared the GitHub Actions workflow directory:

mkdir -p .github/workflows

The workflow configuration was placed inside:

.github/workflows/ci-cd.yml

Configuring the GitHub Actions…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.