diff --git a/.github/workflows/devsecops-pipeline.yml b/.github/workflows/devsecops-pipeline.yml new file mode 100644 index 0000000..f8deeb8 --- /dev/null +++ b/.github/workflows/devsecops-pipeline.yml @@ -0,0 +1,67 @@ +name: devsecops-pipeline +on: + push: + branches: + - 'main' + paths-ignore: + - '**/README.md' +jobs: + devsecops-pipeline: + runs-on: ubuntu-latest + steps: + - name: Code Checkout + uses: actions/checkout@v7 + with: + fetch-depth: 0 + + - name: Secret Scanning + uses: gitleaks/gitleaks-action@v3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: SonarQube Scan + uses: SonarSource/sonarqube-scan-action@v8.2.1 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + - name: Run Snyk to check for vulnerabilities + uses: snyk/actions/python@master + env: + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} + + docker-pipeline: + needs: devsecops-pipeline + runs-on: ubuntu-latest + steps: + - name: Code Checkout + uses: actions/checkout@v7 + with: + fetch-depth: 0 + + - name: Login to Docker Hub + uses: docker/login-action@v4 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Docker Linting + uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: Dockerfile + ignore: DL4000 + + - name: Docker Build + run: docker build -t ${{ vars.DOCKERHUB_USERNAME }}/helloworld-demo-python:latest . + + - name: Docker Images + run: docker images + + - name: Docker Container + run: docker run -itd ${{ vars.DOCKERHUB_USERNAME }}/helloworld-demo-python:latest + + - name: Docker Container Lists + run: docker ps + + - name: Docker Push + run: docker push ${{ vars.DOCKERHUB_USERNAME }}/helloworld-demo-python:latest + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..aaf5415 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.14.7-alpine3.24 +MAINTAINER Annamalai +LABEL description="DevSecOps Demo" +RUN mkdir /app +COPY . /app +WORKDIR /app +EXPOSE 8080 +CMD ["python3", "app.py"] diff --git a/README.md b/README.md index 7456b86..f19900b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# A Simple Hello World Python Demo +# A Simple Hello World Python Demo - DevSecOps - 05-08-2026 Hello Example used to demonstrate ```docker init``` CLI for a simple Hello World Python Program diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..bd1cafd --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,6 @@ +sonar.organization=annaanjali2 +sonar.projectKey=annaanjali2_helloworld-demo-python + +# relative paths to source directories. More details and properties are described +# at https://docs.sonarsource.com/sonarqube-cloud/advanced-setup/analysis-scope/ +sonar.sources=.