diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..a1d6ddb1e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,64 @@ +name: CI + +on: [push] + +jobs: + sast_scan: + name: Run Bandit Scan on app + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install Bandit + run: pip install bandit + + - name: Run Bandit Scan in current directory + run: bandit -ll -ii -r . -f json -o bandit-report.json + + - name: Upload the artifact(s) + uses: actions/upload-artifact@v3 + if: always() + with: + name: Bandit vulnerability findings + path: bandit-report.json + + dockerimage_scan: + name: Build our image and run a scan on it + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up our docker + uses: docker-practice/actions-setup-docker@v1 + with: + docker_version: '20.10' + + - name: Set up Docker daemon configuration + run: | + echo '{ + "hosts": ["unix:///var/run/docker.sock"], + "live-restore": true + }' | sudo tee /etc/docker/daemon.json + # Ensure Docker is restarted to apply configuration + - name: Restart Docker + run: | + sudo systemctl restart docker + + - name: Build the image + run: docker build -f Dockerfile -t agapp:latest . + + - name: Docker Scout Scan image + run: | + curl -fsSL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh -o install-scout.sh + sh install-scout.sh + docker scout quickview + docker scout cves diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml deleted file mode 100644 index 0885ac6f4..000000000 --- a/.github/workflows/flake8.yml +++ /dev/null @@ -1,33 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Flake8 - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 - run: | - pip install flake8 - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics diff --git a/.github/workflows/hadolint.yml b/.github/workflows/hadolint.yml deleted file mode 100644 index bf04ce9c6..000000000 --- a/.github/workflows/hadolint.yml +++ /dev/null @@ -1,41 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. -# hadoint is a Dockerfile linter written in Haskell -# that helps you build best practice Docker images. -# More details at https://github.com/hadolint/hadolint -# testing the pipeline - -name: Hadolint - -on: - push: - branches: [ master ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] - - -permissions: - contents: read - -jobs: - hadolint: - name: Run hadolint scanning - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Run hadolint on Dockerfile - uses: hadolint/hadolint-action@f988afea3da57ee48710a9795b6bb677cc901183 - with: - dockerfile: ./Dockerfile - - - name: Run hadolint on pygoat/Dockerfile - uses: hadolint/hadolint-action@f988afea3da57ee48710a9795b6bb677cc901183 - with: - dockerfile: ./Dockerfile - diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 3d39f83af..000000000 --- a/docker-compose.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: "3.3" - -services: - db: - image: postgres - volumes: - - ./data/db:/var/lib/postgresql/data - environment: - - POSTGRES_DB=postgres - - POSTGRES_USER=postgres - - POSTGRES_PASSWORD=postgres - web: - build: . - image: pygoat/pygoat - command: gunicorn --bind 0.0.0.0:8000 --workers 6 pygoat.wsgi - ports: - - "8000:8000" - volumes: - - .:/app - depends_on: - - migration - - db - migration: - image: pygoat/pygoat - command: python pygoat/manage.py migrate --noinput - volumes: - - .:/app - depends_on: - - db