Skip to content

Added PHP version checks. #44

Added PHP version checks.

Added PHP version checks. #44

Workflow file for this run

name: Docker Image CI
on:
workflow_dispatch:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name : Build and push DVWA image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/dvwa
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "master" ] && VERSION=latest
COMMIT=$(echo "${{ github.sha }}" | cut -c 1-7)
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
echo COMMIT=$COMMIT
docker image build --tag dvwa .
docker image tag dvwa $IMAGE_ID:$VERSION
docker image tag dvwa $IMAGE_ID:$COMMIT
docker image push $IMAGE_ID:$VERSION
docker image push $IMAGE_ID:$COMMIT