Skip to content

1.0.50 Add variables to the github action #21

1.0.50 Add variables to the github action

1.0.50 Add variables to the github action #21

name: build-scan-push-to-dockerhub
on:
push:
branches:
- 'main'
env:
DATABASE_CONTAINER_NAME: "database"
DATABASE_ADMIN_CONTAINER_NAME: "database_admin"
LDAP_CONTAINER_NAME: "ldap"
LDAP_ADMIN_CONTAINER_NAME: "ldap_admin"
WEB_CONTAINER_NAME: "www"
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Check out the codebase
uses: actions/checkout@v4
-
name: Get version from version file
run: |
VERSION=$(cat version)
echo "VERSION=$VERSION" >> $GITHUB_ENV
-
name: Set up QEMU on the runner
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx on the runner
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and Export ${{ env,DATABASE_CONTAINER_NAME }} Container to Docker

Check failure on line 45 in .github/workflows/build-and-push-to-dockerhub.yml

View workflow run for this annotation

GitHub Actions / build-scan-push-to-dockerhub

Invalid workflow file

The workflow is not valid. .github/workflows/build-and-push-to-dockerhub.yml (Line: 45, Col: 15): Unexpected symbol: ','. Located at position 4 within expression: env,DATABASE_CONTAINER_NAME .github/workflows/build-and-push-to-dockerhub.yml (Line: 49, Col: 17): Unexpected symbol: ','. Located at position 4 within expression: env,DATABASE_CONTAINER_NAME
uses: docker/build-push-action@v5
with:
context: .
file: ./${{ env,DATABASE_CONTAINER_NAME }}/Dockerfile
load: true
tags: webpwnized/mutillidae:${{ env,DATABASE_CONTAINER_NAME }}
-
name: Run Trivy vulnerability scanner on ${{ env,DATABASE_CONTAINER_NAME }} Container
uses: aquasecurity/trivy-action@master
with:
image-ref: 'webpwnized/mutillidae:${{ env,DATABASE_CONTAINER_NAME }}'
format: 'sarif'
output: '${{ env,DATABASE_CONTAINER_NAME }}-trivy-scan-results.sarif'
-
name: Upload ${{ env,DATABASE_CONTAINER_NAME }} Container Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: '${{ env,DATABASE_CONTAINER_NAME }}-trivy-scan-results.sarif'
-
name: Build and push ${{ env,DATABASE_CONTAINER_NAME }} container
uses: docker/build-push-action@v5
with:
context: .
file: ./${{ env,DATABASE_CONTAINER_NAME }}/Dockerfile
push: true
tags: webpwnized/mutillidae:${{ env,DATABASE_CONTAINER_NAME }}
-
name: Build and push ${{ env,DATABASE_CONTAINER_NAME }} container with version number
uses: docker/build-push-action@v5
with:
context: .
file: ./${{ env,DATABASE_CONTAINER_NAME }}/Dockerfile
push: true
tags: webpwnized/mutillidae:${{ env,DATABASE_CONTAINER_NAME }}-${{ env.VERSION }}
-
name: Build and push database_admin container
uses: docker/build-push-action@v5
with:
context: .
file: ./database_admin/Dockerfile
push: true
tags: webpwnized/mutillidae:database_admin
-
name: Build and push database_admin container
uses: docker/build-push-action@v5
with:
context: .
file: ./database_admin/Dockerfile
push: true
tags: webpwnized/mutillidae:database_admin-${{ env.VERSION }}
-
name: Build and push ldap container
uses: docker/build-push-action@v5
with:
context: .
file: ./ldap/Dockerfile
push: true
tags: webpwnized/mutillidae:ldap
-
name: Build and push ldap container
uses: docker/build-push-action@v5
with:
context: .
file: ./ldap/Dockerfile
push: true
tags: webpwnized/mutillidae:ldap-${{ env.VERSION }}
-
name: Build and push ldap_admin container
uses: docker/build-push-action@v5
with:
context: .
file: ./ldap_admin/Dockerfile
push: true
tags: webpwnized/mutillidae:ldap_admin
-
name: Build and push ldap_admin container
uses: docker/build-push-action@v5
with:
context: .
file: ./ldap_admin/Dockerfile
push: true
tags: webpwnized/mutillidae:ldap_admin-${{ env.VERSION }}
-
name: Build and push www container
uses: docker/build-push-action@v5
with:
context: .
file: ./www/Dockerfile
push: true
tags: webpwnized/mutillidae:www
-
name: Build and push www container
uses: docker/build-push-action@v5
with:
context: .
file: ./www/Dockerfile
push: true
tags: webpwnized/mutillidae:www-${{ env.VERSION }}