Update Dockerfile (#260) #198
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Integrate | |
on: | |
push: | |
branches: | |
- 'master' | |
paths-ignore: | |
- '.vscode/**' | |
- 'charts/**' | |
- 'docs/**' | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: apache/ats-ingress | |
jobs: | |
build-and-integrate: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
packages: write | |
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- name: Setup Minikube | |
uses: manusa/[email protected] | |
with: | |
minikube version: 'v1.34.0' | |
kubernetes version: 'v1.30.6' | |
driver: 'docker' | |
container runtime: 'docker' | |
github token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.8.18' | |
- name: Build ATS Alpine | |
run: | | |
eval $(minikube -p minikube docker-env) | |
docker build -t ats-ingress . --network=host | |
# - name: Build Exporter | |
# run: docker build -t ats-ingress-exporter k8s/images/trafficserver_exporter/ | |
- name: Build App 1 | |
run: | | |
eval $(minikube -p minikube docker-env) | |
docker build -t node-app-1 k8s/images/node-app-1/ | |
- name: Build App 2 | |
run: | | |
eval $(minikube -p minikube docker-env) | |
docker build -t node-app-2 k8s/images/node-app-2/ | |
- name: Install dependencies | |
run: | | |
cd tests | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Test | |
run: | | |
cd tests | |
pytest -q --minikubeip="$(minikube ip)" suite/test_ingress.py | |
- name: Log in to the Container registry | |
if: github.repository == 'apache/trafficserver-ingress-controller' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
if: github.repository == 'apache/trafficserver-ingress-controller' | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }} | |
- name: Build and push Docker image | |
if: github.repository == 'apache/trafficserver-ingress-controller' | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
no-cache: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Run Trivy vulnerability scanner | |
if: github.repository == 'apache/trafficserver-ingress-controller' | |
uses: aquasecurity/[email protected] | |
with: | |
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
format: 'sarif' | |
output: 'trivy-results.sarif' | |
- name: Upload Trivy scan results to GitHub Security tab | |
if: github.repository == 'apache/trafficserver-ingress-controller' | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: 'trivy-results.sarif' |